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