]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/gtk/streams.cpp
added support for polygons to wxRegion
[wxWidgets.git] / wxPython / src / gtk / streams.cpp
1 /*
2 * FILE : src/gtk/streams.cpp
3 *
4 * This file was automatically generated by :
5 * Simplified Wrapper and Interface Generator (SWIG)
6 * Version 1.1 (Build 883)
7 *
8 * Portions Copyright (c) 1995-1998
9 * The University of Utah and The Regents of the University of California.
10 * Permission is granted to distribute this file in any manner provided
11 * this notice remains intact.
12 *
13 * Do not make changes to this file--changes will be lost!
14 *
15 */
16
17
18 #define SWIGCODE
19 /* Implementation : PYTHON */
20
21 #define SWIGPYTHON
22 #include <string.h>
23 #include <stdlib.h>
24 /* Definitions for Windows/Unix exporting */
25 #if defined(__WIN32__)
26 # if defined(_MSC_VER)
27 # define SWIGEXPORT(a) __declspec(dllexport) a
28 # else
29 # if defined(__BORLANDC__)
30 # define SWIGEXPORT(a) a _export
31 # else
32 # define SWIGEXPORT(a) a
33 # endif
34 # endif
35 #else
36 # define SWIGEXPORT(a) a
37 #endif
38
39 #include "Python.h"
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 extern void SWIG_MakePtr(char *, void *, char *);
46 extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
47 extern char *SWIG_GetPtr(char *, void **, char *);
48 extern char *SWIG_GetPtrObj(PyObject *, void **, char *);
49 extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
50 extern PyObject *SWIG_newvarlink(void);
51 #ifdef __cplusplus
52 }
53 #endif
54 #define SWIG_init initstreamsc
55
56 #define SWIG_name "streamsc"
57
58 #include "helpers.h"
59 #include <wx/stream.h>
60 #include <wx/list.h>
61
62
63 static PyObject* t_output_helper(PyObject* target, PyObject* o) {
64 PyObject* o2;
65 PyObject* o3;
66
67 if (!target) {
68 target = o;
69 } else if (target == Py_None) {
70 Py_DECREF(Py_None);
71 target = o;
72 } else {
73 if (!PyTuple_Check(target)) {
74 o2 = target;
75 target = PyTuple_New(1);
76 PyTuple_SetItem(target, 0, o2);
77 }
78 o3 = PyTuple_New(1);
79 PyTuple_SetItem(o3, 0, o);
80
81 o2 = target;
82 target = PySequence_Concat(o2, o3);
83 Py_DECREF(o2);
84 Py_DECREF(o3);
85 }
86 return target;
87 }
88
89 #if PYTHON_API_VERSION >= 1009
90 static char* wxStringErrorMsg = "String or Unicode type required";
91 #else
92 static char* wxStringErrorMsg = "string type is required for parameter";
93 #endif
94 // C++
95 // definitions of wxStringPtrList and wxPyInputStream
96 #include <wx/listimpl.cpp>
97 WX_DEFINE_LIST(wxStringPtrList);
98
99
100 void wxPyInputStream::close() {
101 /* do nothing */
102 }
103
104 void wxPyInputStream::flush() {
105 /*do nothing*/
106 }
107
108 bool wxPyInputStream::eof() {
109 if (wxi)
110 return wxi->Eof();
111 else
112 return TRUE;
113 }
114
115 wxPyInputStream::~wxPyInputStream() {
116 /*do nothing*/
117 }
118
119 wxString* wxPyInputStream::read(int size) {
120 wxString* s = NULL;
121 const int BUFSIZE = 1024;
122
123 // check if we have a real wxInputStream to work with
124 if (!wxi) {
125 PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
126 return NULL;
127 }
128
129 if (size < 0) {
130 // init buffers
131 char * buf = new char[BUFSIZE];
132 if (!buf) {
133 PyErr_NoMemory();
134 return NULL;
135 }
136
137 s = new wxString();
138 if (!s) {
139 delete buf;
140 PyErr_NoMemory();
141 return NULL;
142 }
143
144 // read until EOF
145 wxPy_BEGIN_ALLOW_THREADS;
146 while (! wxi->Eof()) {
147 wxi->Read(buf, BUFSIZE);
148 //*s += wxString(buf, wxi->LastRead());
149 s->Append(buf, wxi->LastRead());
150 }
151 delete buf;
152 wxPy_END_ALLOW_THREADS;
153
154 // error check
155 if (wxi->LastError() == wxSTREAM_READ_ERROR) {
156 delete s;
157 PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
158 return NULL;
159 }
160
161 } else { // Read only size number of characters
162 s = new wxString;
163 if (!s) {
164 PyErr_NoMemory();
165 return NULL;
166 }
167
168 // read size bytes
169 wxPy_BEGIN_ALLOW_THREADS;
170 wxi->Read(s->GetWriteBuf(size+1), size);
171 s->UngetWriteBuf(wxi->LastRead());
172 wxPy_END_ALLOW_THREADS;
173
174 // error check
175 if (wxi->LastError() == wxSTREAM_READ_ERROR) {
176 delete s;
177 PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
178 return NULL;
179 }
180 }
181 return s;
182 }
183
184
185 wxString* wxPyInputStream::readline (int size) {
186 // check if we have a real wxInputStream to work with
187 if (!wxi) {
188 PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
189 return NULL;
190 }
191
192 // init buffer
193 int i;
194 char ch;
195 wxString* s = new wxString;
196 if (!s) {
197 PyErr_NoMemory();
198 return NULL;
199 }
200
201 // read until \n or byte limit reached
202 wxPy_BEGIN_ALLOW_THREADS;
203 for (i=ch=0; (ch != '\n') && (!wxi->Eof()) && ((size < 0) || (i < size)); i++) {
204 *s += ch = wxi->GetC();
205 }
206 wxPy_END_ALLOW_THREADS;
207
208 // errorcheck
209 if (wxi->LastError() == wxSTREAM_READ_ERROR) {
210 delete s;
211 PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
212 return NULL;
213 }
214 return s;
215 }
216
217
218 wxStringPtrList* wxPyInputStream::readlines (int sizehint) {
219 // check if we have a real wxInputStream to work with
220 if (!wxi) {
221 PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
222 return NULL;
223 }
224
225 // init list
226 wxStringPtrList* l = new wxStringPtrList();
227 if (!l) {
228 PyErr_NoMemory();
229 return NULL;
230 }
231
232 // read sizehint bytes or until EOF
233 wxPy_BEGIN_ALLOW_THREADS;
234 int i;
235 for (i=0; (!wxi->Eof()) && ((sizehint < 0) || (i < sizehint));) {
236 wxString* s = readline();
237 if (s == NULL) {
238 l->DeleteContents(TRUE);
239 l->Clear();
240 return NULL;
241 }
242 l->Append(s);
243 i = i + s->Length();
244 }
245 wxPy_END_ALLOW_THREADS;
246
247 // error check
248 if (wxi->LastError() == wxSTREAM_READ_ERROR) {
249 l->DeleteContents(TRUE);
250 l->Clear();
251 PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
252 return NULL;
253 }
254 return l;
255 }
256
257
258 void wxPyInputStream::seek(int offset, int whence) {
259 if (wxi)
260 wxi->SeekI(offset, wxSeekMode(whence));
261 }
262
263 int wxPyInputStream::tell(){
264 if (wxi)
265 return wxi->TellI();
266 }
267
268
269
270 // wxInputStream which operates on a Python file-like object
271 class wxPyCBInputStream : public wxInputStream {
272 protected:
273 PyObject* read;
274 PyObject* seek;
275 PyObject* tell;
276 PyObject* py;
277
278 virtual size_t OnSysRead(void *buffer, size_t bufsize) {
279 if (bufsize == 0)
280 return 0;
281
282 bool doSave = wxPyRestoreThread();
283 PyObject* arglist = Py_BuildValue("(i)", bufsize);
284 PyObject* result = PyEval_CallObject(read, arglist);
285 Py_DECREF(arglist);
286
287 size_t o = 0;
288 if ((result != NULL) && PyString_Check(result)) {
289 o = PyString_Size(result);
290 if (o == 0)
291 m_lasterror = wxSTREAM_EOF;
292 if (o > bufsize)
293 o = bufsize;
294 strncpy((char*)buffer, PyString_AsString(result), o);
295 Py_DECREF(result);
296
297 }
298 else
299 m_lasterror = wxSTREAM_READ_ERROR;
300 wxPySaveThread(doSave);
301 m_lastcount = o;
302 return o;
303 }
304
305 virtual size_t OnSysWrite(const void *buffer, size_t bufsize){
306 m_lasterror = wxSTREAM_WRITE_ERROR;
307 return 0;
308 }
309
310 virtual off_t OnSysSeek(off_t off, wxSeekMode mode){
311 bool doSave = wxPyRestoreThread();
312 PyObject*arglist = Py_BuildValue("(ii)", off, mode);
313 PyObject*result = PyEval_CallObject(seek, arglist);
314 Py_DECREF(arglist);
315 Py_XDECREF(result);
316 wxPySaveThread(doSave);
317 return OnSysTell();
318 }
319
320 virtual off_t OnSysTell() const{
321 bool doSave = wxPyRestoreThread();
322 PyObject* arglist = Py_BuildValue("()");
323 PyObject* result = PyEval_CallObject(tell, arglist);
324 Py_DECREF(arglist);
325 off_t o = 0;
326 if (result != NULL) {
327 o = PyInt_AsLong(result);
328 Py_DECREF(result);
329 };
330 wxPySaveThread(doSave);
331 return o;
332 }
333
334 wxPyCBInputStream(PyObject *p, PyObject *r, PyObject *s, PyObject *t)
335 : py(p), read(r), seek(s), tell(t)
336 {}
337
338 public:
339 ~wxPyCBInputStream() {
340 bool doSave = wxPyRestoreThread();
341 Py_XDECREF(py);
342 Py_XDECREF(read);
343 Py_XDECREF(seek);
344 Py_XDECREF(tell);
345 wxPySaveThread(doSave);
346 }
347
348 virtual size_t GetSize() {
349 if (seek && tell) {
350 off_t temp = OnSysTell();
351 off_t ret = OnSysSeek(0, wxFromEnd);
352 OnSysSeek(temp, wxFromStart);
353 return ret;
354 }
355 else
356 return 0;
357 }
358
359 static wxPyCBInputStream* create(PyObject *py) {
360 PyObject* read;
361 PyObject* seek;
362 PyObject* tell;
363
364 if (!PyInstance_Check(py) && !PyFile_Check(py)) {
365 PyErr_SetString(PyExc_TypeError, "Not a file-like object");
366 Py_XDECREF(py);
367 return NULL;
368 }
369 read = getMethod(py, "read");
370 seek = getMethod(py, "seek");
371 tell = getMethod(py, "tell");
372
373 if (!read) {
374 PyErr_SetString(PyExc_TypeError, "Not a file-like object");
375 Py_XDECREF(py);
376 Py_XDECREF(read);
377 Py_XDECREF(seek);
378 Py_XDECREF(tell);
379 return NULL;
380 }
381 return new wxPyCBInputStream(py, read, seek, tell);
382 }
383
384 static PyObject* getMethod(PyObject* py, char* name) {
385 if (!PyObject_HasAttrString(py, name))
386 return NULL;
387 PyObject* o = PyObject_GetAttrString(py, name);
388 if (!PyMethod_Check(o) && !PyCFunction_Check(o)) {
389 Py_DECREF(o);
390 return NULL;
391 }
392 return o;
393 }
394
395 protected:
396
397 };
398
399 #ifdef __cplusplus
400 extern "C" {
401 #endif
402 static wxPyInputStream *new_wxPyInputStream(PyObject *p) {
403 wxInputStream* wxi = wxPyCBInputStream::create(p);
404 if (wxi)
405 return new wxPyInputStream(wxi);
406 else
407 return NULL;
408 }
409
410 static PyObject *_wrap_new_wxInputStream(PyObject *self, PyObject *args, PyObject *kwargs) {
411 PyObject * _resultobj;
412 wxPyInputStream * _result;
413 PyObject * _arg0;
414 PyObject * _obj0 = 0;
415 char *_kwnames[] = { "p", NULL };
416 char _ptemp[128];
417
418 self = self;
419 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:new_wxInputStream",_kwnames,&_obj0))
420 return NULL;
421 {
422 _arg0 = _obj0;
423 }
424 {
425 _result = (wxPyInputStream *)new_wxPyInputStream(_arg0);
426
427 } if (_result) {
428 SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyInputStream_p");
429 _resultobj = Py_BuildValue("s",_ptemp);
430 } else {
431 Py_INCREF(Py_None);
432 _resultobj = Py_None;
433 }
434 return _resultobj;
435 }
436
437 #define wxInputStream_close(_swigobj) (_swigobj->close())
438 static PyObject *_wrap_wxInputStream_close(PyObject *self, PyObject *args, PyObject *kwargs) {
439 PyObject * _resultobj;
440 wxPyInputStream * _arg0;
441 PyObject * _argo0 = 0;
442 char *_kwnames[] = { "self", NULL };
443
444 self = self;
445 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_close",_kwnames,&_argo0))
446 return NULL;
447 if (_argo0) {
448 if (_argo0 == Py_None) { _arg0 = NULL; }
449 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
450 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_close. Expected _wxPyInputStream_p.");
451 return NULL;
452 }
453 }
454 {
455 wxInputStream_close(_arg0);
456
457 } Py_INCREF(Py_None);
458 _resultobj = Py_None;
459 return _resultobj;
460 }
461
462 #define wxInputStream_flush(_swigobj) (_swigobj->flush())
463 static PyObject *_wrap_wxInputStream_flush(PyObject *self, PyObject *args, PyObject *kwargs) {
464 PyObject * _resultobj;
465 wxPyInputStream * _arg0;
466 PyObject * _argo0 = 0;
467 char *_kwnames[] = { "self", NULL };
468
469 self = self;
470 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_flush",_kwnames,&_argo0))
471 return NULL;
472 if (_argo0) {
473 if (_argo0 == Py_None) { _arg0 = NULL; }
474 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
475 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_flush. Expected _wxPyInputStream_p.");
476 return NULL;
477 }
478 }
479 {
480 wxInputStream_flush(_arg0);
481
482 } Py_INCREF(Py_None);
483 _resultobj = Py_None;
484 return _resultobj;
485 }
486
487 #define wxInputStream_eof(_swigobj) (_swigobj->eof())
488 static PyObject *_wrap_wxInputStream_eof(PyObject *self, PyObject *args, PyObject *kwargs) {
489 PyObject * _resultobj;
490 bool _result;
491 wxPyInputStream * _arg0;
492 PyObject * _argo0 = 0;
493 char *_kwnames[] = { "self", NULL };
494
495 self = self;
496 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_eof",_kwnames,&_argo0))
497 return NULL;
498 if (_argo0) {
499 if (_argo0 == Py_None) { _arg0 = NULL; }
500 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
501 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_eof. Expected _wxPyInputStream_p.");
502 return NULL;
503 }
504 }
505 {
506 _result = (bool )wxInputStream_eof(_arg0);
507
508 } _resultobj = Py_BuildValue("i",_result);
509 return _resultobj;
510 }
511
512 #define wxInputStream_read(_swigobj,_swigarg0) (_swigobj->read(_swigarg0))
513 static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObject *kwargs) {
514 PyObject * _resultobj;
515 wxString * _result;
516 wxPyInputStream * _arg0;
517 int _arg1 = (int ) -1;
518 PyObject * _argo0 = 0;
519 char *_kwnames[] = { "self","size", NULL };
520
521 self = self;
522 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_read",_kwnames,&_argo0,&_arg1))
523 return NULL;
524 if (_argo0) {
525 if (_argo0 == Py_None) { _arg0 = NULL; }
526 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
527 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_read. Expected _wxPyInputStream_p.");
528 return NULL;
529 }
530 }
531 {
532 _result = (wxString *)wxInputStream_read(_arg0,_arg1);
533
534 }{
535 if (_result) {
536 _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
537 delete _result;
538 }
539 else
540 _resultobj=0;
541 }
542 return _resultobj;
543 }
544
545 #define wxInputStream_readline(_swigobj,_swigarg0) (_swigobj->readline(_swigarg0))
546 static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, PyObject *kwargs) {
547 PyObject * _resultobj;
548 wxString * _result;
549 wxPyInputStream * _arg0;
550 int _arg1 = (int ) -1;
551 PyObject * _argo0 = 0;
552 char *_kwnames[] = { "self","size", NULL };
553
554 self = self;
555 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_readline",_kwnames,&_argo0,&_arg1))
556 return NULL;
557 if (_argo0) {
558 if (_argo0 == Py_None) { _arg0 = NULL; }
559 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
560 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_readline. Expected _wxPyInputStream_p.");
561 return NULL;
562 }
563 }
564 {
565 _result = (wxString *)wxInputStream_readline(_arg0,_arg1);
566
567 }{
568 if (_result) {
569 _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
570 delete _result;
571 }
572 else
573 _resultobj=0;
574 }
575 return _resultobj;
576 }
577
578 #define wxInputStream_readlines(_swigobj,_swigarg0) (_swigobj->readlines(_swigarg0))
579 static PyObject *_wrap_wxInputStream_readlines(PyObject *self, PyObject *args, PyObject *kwargs) {
580 PyObject * _resultobj;
581 wxStringPtrList * _result;
582 wxPyInputStream * _arg0;
583 int _arg1 = (int ) -1;
584 PyObject * _argo0 = 0;
585 char *_kwnames[] = { "self","sizehint", NULL };
586
587 self = self;
588 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_readlines",_kwnames,&_argo0,&_arg1))
589 return NULL;
590 if (_argo0) {
591 if (_argo0 == Py_None) { _arg0 = NULL; }
592 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
593 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_readlines. Expected _wxPyInputStream_p.");
594 return NULL;
595 }
596 }
597 {
598 _result = (wxStringPtrList *)wxInputStream_readlines(_arg0,_arg1);
599
600 }{
601 if (_result) {
602 _resultobj = PyList_New(_result->GetCount());
603 wxStringPtrList::Node *node = _result->GetFirst();
604 for (int i=0; node; i++) {
605 wxString *s = node->GetData();
606 PyList_SetItem(_resultobj, i, PyString_FromStringAndSize(s->c_str(), s->Len()));
607 node = node->GetNext();
608 delete s;
609 }
610 delete _result;
611 }
612 else
613 _resultobj=0;
614 }
615 return _resultobj;
616 }
617
618 #define wxInputStream_seek(_swigobj,_swigarg0,_swigarg1) (_swigobj->seek(_swigarg0,_swigarg1))
619 static PyObject *_wrap_wxInputStream_seek(PyObject *self, PyObject *args, PyObject *kwargs) {
620 PyObject * _resultobj;
621 wxPyInputStream * _arg0;
622 int _arg1;
623 int _arg2 = (int ) 0;
624 PyObject * _argo0 = 0;
625 char *_kwnames[] = { "self","offset","whence", NULL };
626
627 self = self;
628 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxInputStream_seek",_kwnames,&_argo0,&_arg1,&_arg2))
629 return NULL;
630 if (_argo0) {
631 if (_argo0 == Py_None) { _arg0 = NULL; }
632 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
633 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_seek. Expected _wxPyInputStream_p.");
634 return NULL;
635 }
636 }
637 {
638 wxInputStream_seek(_arg0,_arg1,_arg2);
639
640 } Py_INCREF(Py_None);
641 _resultobj = Py_None;
642 return _resultobj;
643 }
644
645 #define wxInputStream_tell(_swigobj) (_swigobj->tell())
646 static PyObject *_wrap_wxInputStream_tell(PyObject *self, PyObject *args, PyObject *kwargs) {
647 PyObject * _resultobj;
648 int _result;
649 wxPyInputStream * _arg0;
650 PyObject * _argo0 = 0;
651 char *_kwnames[] = { "self", NULL };
652
653 self = self;
654 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_tell",_kwnames,&_argo0))
655 return NULL;
656 if (_argo0) {
657 if (_argo0 == Py_None) { _arg0 = NULL; }
658 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
659 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_tell. Expected _wxPyInputStream_p.");
660 return NULL;
661 }
662 }
663 {
664 _result = (int )wxInputStream_tell(_arg0);
665
666 } _resultobj = Py_BuildValue("i",_result);
667 return _resultobj;
668 }
669
670 static void wxOutputStream_write(wxOutputStream *self,const wxString & str) {
671 self->Write(str.c_str(), str.Length());
672 }
673 static PyObject *_wrap_wxOutputStream_write(PyObject *self, PyObject *args, PyObject *kwargs) {
674 PyObject * _resultobj;
675 wxOutputStream * _arg0;
676 wxString * _arg1;
677 PyObject * _argo0 = 0;
678 PyObject * _obj1 = 0;
679 char *_kwnames[] = { "self","str", NULL };
680
681 self = self;
682 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxOutputStream_write",_kwnames,&_argo0,&_obj1))
683 return NULL;
684 if (_argo0) {
685 if (_argo0 == Py_None) { _arg0 = NULL; }
686 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxOutputStream_p")) {
687 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxOutputStream_write. Expected _wxOutputStream_p.");
688 return NULL;
689 }
690 }
691 {
692 #if PYTHON_API_VERSION >= 1009
693 char* tmpPtr; int tmpSize;
694 if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
695 PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
696 return NULL;
697 }
698 if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
699 return NULL;
700 _arg1 = new wxString(tmpPtr, tmpSize);
701 #else
702 if (!PyString_Check(_obj1)) {
703 PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
704 return NULL;
705 }
706 _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
707 #endif
708 }
709 {
710 wxOutputStream_write(_arg0,*_arg1);
711
712 } Py_INCREF(Py_None);
713 _resultobj = Py_None;
714 {
715 if (_obj1)
716 delete _arg1;
717 }
718 return _resultobj;
719 }
720
721 static PyMethodDef streamscMethods[] = {
722 { "wxOutputStream_write", (PyCFunction) _wrap_wxOutputStream_write, METH_VARARGS | METH_KEYWORDS },
723 { "wxInputStream_tell", (PyCFunction) _wrap_wxInputStream_tell, METH_VARARGS | METH_KEYWORDS },
724 { "wxInputStream_seek", (PyCFunction) _wrap_wxInputStream_seek, METH_VARARGS | METH_KEYWORDS },
725 { "wxInputStream_readlines", (PyCFunction) _wrap_wxInputStream_readlines, METH_VARARGS | METH_KEYWORDS },
726 { "wxInputStream_readline", (PyCFunction) _wrap_wxInputStream_readline, METH_VARARGS | METH_KEYWORDS },
727 { "wxInputStream_read", (PyCFunction) _wrap_wxInputStream_read, METH_VARARGS | METH_KEYWORDS },
728 { "wxInputStream_eof", (PyCFunction) _wrap_wxInputStream_eof, METH_VARARGS | METH_KEYWORDS },
729 { "wxInputStream_flush", (PyCFunction) _wrap_wxInputStream_flush, METH_VARARGS | METH_KEYWORDS },
730 { "wxInputStream_close", (PyCFunction) _wrap_wxInputStream_close, METH_VARARGS | METH_KEYWORDS },
731 { "new_wxInputStream", (PyCFunction) _wrap_new_wxInputStream, METH_VARARGS | METH_KEYWORDS },
732 { NULL, NULL }
733 };
734 #ifdef __cplusplus
735 }
736 #endif
737 /*
738 * This table is used by the pointer type-checker
739 */
740 static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
741 { "_signed_long","_long",0},
742 { "_wxPrintQuality","_wxCoord",0},
743 { "_wxPrintQuality","_int",0},
744 { "_wxPrintQuality","_signed_int",0},
745 { "_wxPrintQuality","_unsigned_int",0},
746 { "_wxPrintQuality","_wxWindowID",0},
747 { "_wxPrintQuality","_uint",0},
748 { "_wxPrintQuality","_EBool",0},
749 { "_wxPrintQuality","_size_t",0},
750 { "_wxPrintQuality","_time_t",0},
751 { "_byte","_unsigned_char",0},
752 { "_long","_unsigned_long",0},
753 { "_long","_signed_long",0},
754 { "_size_t","_wxCoord",0},
755 { "_size_t","_wxPrintQuality",0},
756 { "_size_t","_time_t",0},
757 { "_size_t","_unsigned_int",0},
758 { "_size_t","_int",0},
759 { "_size_t","_wxWindowID",0},
760 { "_size_t","_uint",0},
761 { "_uint","_wxCoord",0},
762 { "_uint","_wxPrintQuality",0},
763 { "_uint","_time_t",0},
764 { "_uint","_size_t",0},
765 { "_uint","_unsigned_int",0},
766 { "_uint","_int",0},
767 { "_uint","_wxWindowID",0},
768 { "_wxChar","_char",0},
769 { "_char","_wxChar",0},
770 { "_EBool","_wxCoord",0},
771 { "_EBool","_wxPrintQuality",0},
772 { "_EBool","_signed_int",0},
773 { "_EBool","_int",0},
774 { "_EBool","_wxWindowID",0},
775 { "_unsigned_long","_long",0},
776 { "_signed_int","_wxCoord",0},
777 { "_signed_int","_wxPrintQuality",0},
778 { "_signed_int","_EBool",0},
779 { "_signed_int","_wxWindowID",0},
780 { "_signed_int","_int",0},
781 { "_WXTYPE","_short",0},
782 { "_WXTYPE","_signed_short",0},
783 { "_WXTYPE","_unsigned_short",0},
784 { "_unsigned_short","_WXTYPE",0},
785 { "_unsigned_short","_short",0},
786 { "_signed_short","_WXTYPE",0},
787 { "_signed_short","_short",0},
788 { "_unsigned_char","_byte",0},
789 { "_unsigned_int","_wxCoord",0},
790 { "_unsigned_int","_wxPrintQuality",0},
791 { "_unsigned_int","_time_t",0},
792 { "_unsigned_int","_size_t",0},
793 { "_unsigned_int","_uint",0},
794 { "_unsigned_int","_wxWindowID",0},
795 { "_unsigned_int","_int",0},
796 { "_short","_WXTYPE",0},
797 { "_short","_unsigned_short",0},
798 { "_short","_signed_short",0},
799 { "_wxWindowID","_wxCoord",0},
800 { "_wxWindowID","_wxPrintQuality",0},
801 { "_wxWindowID","_time_t",0},
802 { "_wxWindowID","_size_t",0},
803 { "_wxWindowID","_EBool",0},
804 { "_wxWindowID","_uint",0},
805 { "_wxWindowID","_int",0},
806 { "_wxWindowID","_signed_int",0},
807 { "_wxWindowID","_unsigned_int",0},
808 { "_int","_wxCoord",0},
809 { "_int","_wxPrintQuality",0},
810 { "_int","_time_t",0},
811 { "_int","_size_t",0},
812 { "_int","_EBool",0},
813 { "_int","_uint",0},
814 { "_int","_wxWindowID",0},
815 { "_int","_unsigned_int",0},
816 { "_int","_signed_int",0},
817 { "_time_t","_wxCoord",0},
818 { "_time_t","_wxPrintQuality",0},
819 { "_time_t","_unsigned_int",0},
820 { "_time_t","_int",0},
821 { "_time_t","_wxWindowID",0},
822 { "_time_t","_uint",0},
823 { "_time_t","_size_t",0},
824 { "_wxCoord","_int",0},
825 { "_wxCoord","_signed_int",0},
826 { "_wxCoord","_unsigned_int",0},
827 { "_wxCoord","_wxWindowID",0},
828 { "_wxCoord","_uint",0},
829 { "_wxCoord","_EBool",0},
830 { "_wxCoord","_size_t",0},
831 { "_wxCoord","_time_t",0},
832 { "_wxCoord","_wxPrintQuality",0},
833 {0,0,0}};
834
835 static PyObject *SWIG_globals;
836 #ifdef __cplusplus
837 extern "C"
838 #endif
839 SWIGEXPORT(void) initstreamsc() {
840 PyObject *m, *d;
841 SWIG_globals = SWIG_newvarlink();
842 m = Py_InitModule("streamsc", streamscMethods);
843 d = PyModule_GetDict(m);
844
845 wxPyPtrTypeMap_Add("wxInputStream", "wxPyInputStream");
846 {
847 int i;
848 for (i = 0; _swig_mapping[i].n1; i++)
849 SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
850 }
851 }