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