]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/msw/streams.cpp
updated generated sources for wxMSW
[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 #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
436 self = self;
437 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:new_wxInputStream",_kwnames,&_obj0))
438 return NULL;
439 {
440 _arg0 = _obj0;
441 }
442 {
443 _result = (wxPyInputStream *)new_wxPyInputStream(_arg0);
444
445 }{
446 char _ptemp[128];
447 if (_result) {
448 SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyInputStream_p");
449 _resultobj = Py_BuildValue("s",_ptemp);
450 }
451 else
452 _resultobj=0;
453 }
454 return _resultobj;
455 }
456
457 #define wxInputStream_close(_swigobj) (_swigobj->close())
458 static PyObject *_wrap_wxInputStream_close(PyObject *self, PyObject *args, PyObject *kwargs) {
459 PyObject * _resultobj;
460 wxPyInputStream * _arg0;
461 PyObject * _argo0 = 0;
462 char *_kwnames[] = { "self", NULL };
463
464 self = self;
465 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_close",_kwnames,&_argo0))
466 return NULL;
467 if (_argo0) {
468 if (_argo0 == Py_None) { _arg0 = NULL; }
469 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
470 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_close. Expected _wxPyInputStream_p.");
471 return NULL;
472 }
473 }
474 {
475 wxInputStream_close(_arg0);
476
477 } Py_INCREF(Py_None);
478 _resultobj = Py_None;
479 return _resultobj;
480 }
481
482 #define wxInputStream_flush(_swigobj) (_swigobj->flush())
483 static PyObject *_wrap_wxInputStream_flush(PyObject *self, PyObject *args, PyObject *kwargs) {
484 PyObject * _resultobj;
485 wxPyInputStream * _arg0;
486 PyObject * _argo0 = 0;
487 char *_kwnames[] = { "self", NULL };
488
489 self = self;
490 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_flush",_kwnames,&_argo0))
491 return NULL;
492 if (_argo0) {
493 if (_argo0 == Py_None) { _arg0 = NULL; }
494 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
495 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_flush. Expected _wxPyInputStream_p.");
496 return NULL;
497 }
498 }
499 {
500 wxInputStream_flush(_arg0);
501
502 } Py_INCREF(Py_None);
503 _resultobj = Py_None;
504 return _resultobj;
505 }
506
507 #define wxInputStream_eof(_swigobj) (_swigobj->eof())
508 static PyObject *_wrap_wxInputStream_eof(PyObject *self, PyObject *args, PyObject *kwargs) {
509 PyObject * _resultobj;
510 bool _result;
511 wxPyInputStream * _arg0;
512 PyObject * _argo0 = 0;
513 char *_kwnames[] = { "self", NULL };
514
515 self = self;
516 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_eof",_kwnames,&_argo0))
517 return NULL;
518 if (_argo0) {
519 if (_argo0 == Py_None) { _arg0 = NULL; }
520 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
521 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_eof. Expected _wxPyInputStream_p.");
522 return NULL;
523 }
524 }
525 {
526 _result = (bool )wxInputStream_eof(_arg0);
527
528 } _resultobj = Py_BuildValue("i",_result);
529 return _resultobj;
530 }
531
532 #define wxInputStream_read(_swigobj,_swigarg0) (_swigobj->read(_swigarg0))
533 static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObject *kwargs) {
534 PyObject * _resultobj;
535 wxString * _result;
536 wxPyInputStream * _arg0;
537 int _arg1 = (int ) -1;
538 PyObject * _argo0 = 0;
539 char *_kwnames[] = { "self","size", NULL };
540
541 self = self;
542 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_read",_kwnames,&_argo0,&_arg1))
543 return NULL;
544 if (_argo0) {
545 if (_argo0 == Py_None) { _arg0 = NULL; }
546 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
547 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_read. Expected _wxPyInputStream_p.");
548 return NULL;
549 }
550 }
551 {
552 _result = (wxString *)wxInputStream_read(_arg0,_arg1);
553
554 }{
555 if (_result) {
556 _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
557 delete _result;
558 }
559 else
560 _resultobj=0;
561 }
562 return _resultobj;
563 }
564
565 #define wxInputStream_readline(_swigobj,_swigarg0) (_swigobj->readline(_swigarg0))
566 static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, PyObject *kwargs) {
567 PyObject * _resultobj;
568 wxString * _result;
569 wxPyInputStream * _arg0;
570 int _arg1 = (int ) -1;
571 PyObject * _argo0 = 0;
572 char *_kwnames[] = { "self","size", NULL };
573
574 self = self;
575 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_readline",_kwnames,&_argo0,&_arg1))
576 return NULL;
577 if (_argo0) {
578 if (_argo0 == Py_None) { _arg0 = NULL; }
579 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
580 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_readline. Expected _wxPyInputStream_p.");
581 return NULL;
582 }
583 }
584 {
585 _result = (wxString *)wxInputStream_readline(_arg0,_arg1);
586
587 }{
588 if (_result) {
589 _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
590 delete _result;
591 }
592 else
593 _resultobj=0;
594 }
595 return _resultobj;
596 }
597
598 #define wxInputStream_readlines(_swigobj,_swigarg0) (_swigobj->readlines(_swigarg0))
599 static PyObject *_wrap_wxInputStream_readlines(PyObject *self, PyObject *args, PyObject *kwargs) {
600 PyObject * _resultobj;
601 wxStringPtrList * _result;
602 wxPyInputStream * _arg0;
603 int _arg1 = (int ) -1;
604 PyObject * _argo0 = 0;
605 char *_kwnames[] = { "self","sizehint", NULL };
606
607 self = self;
608 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_readlines",_kwnames,&_argo0,&_arg1))
609 return NULL;
610 if (_argo0) {
611 if (_argo0 == Py_None) { _arg0 = NULL; }
612 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
613 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_readlines. Expected _wxPyInputStream_p.");
614 return NULL;
615 }
616 }
617 {
618 _result = (wxStringPtrList *)wxInputStream_readlines(_arg0,_arg1);
619
620 }{
621 if (_result) {
622 _resultobj = PyList_New(_result->GetCount());
623 wxStringPtrList::Node *node = _result->GetFirst();
624 for (int i=0; node; i++) {
625 wxString *s = node->GetData();
626 PyList_SetItem(_resultobj, i, PyString_FromStringAndSize(s->c_str(), s->Len()));
627 node = node->GetNext();
628 delete s;
629 }
630 delete _result;
631 }
632 else
633 _resultobj=0;
634 }
635 return _resultobj;
636 }
637
638 #define wxInputStream_seek(_swigobj,_swigarg0,_swigarg1) (_swigobj->seek(_swigarg0,_swigarg1))
639 static PyObject *_wrap_wxInputStream_seek(PyObject *self, PyObject *args, PyObject *kwargs) {
640 PyObject * _resultobj;
641 wxPyInputStream * _arg0;
642 int _arg1;
643 int _arg2 = (int ) 0;
644 PyObject * _argo0 = 0;
645 char *_kwnames[] = { "self","offset","whence", NULL };
646
647 self = self;
648 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxInputStream_seek",_kwnames,&_argo0,&_arg1,&_arg2))
649 return NULL;
650 if (_argo0) {
651 if (_argo0 == Py_None) { _arg0 = NULL; }
652 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
653 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_seek. Expected _wxPyInputStream_p.");
654 return NULL;
655 }
656 }
657 {
658 wxInputStream_seek(_arg0,_arg1,_arg2);
659
660 } Py_INCREF(Py_None);
661 _resultobj = Py_None;
662 return _resultobj;
663 }
664
665 #define wxInputStream_tell(_swigobj) (_swigobj->tell())
666 static PyObject *_wrap_wxInputStream_tell(PyObject *self, PyObject *args, PyObject *kwargs) {
667 PyObject * _resultobj;
668 int _result;
669 wxPyInputStream * _arg0;
670 PyObject * _argo0 = 0;
671 char *_kwnames[] = { "self", NULL };
672
673 self = self;
674 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_tell",_kwnames,&_argo0))
675 return NULL;
676 if (_argo0) {
677 if (_argo0 == Py_None) { _arg0 = NULL; }
678 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
679 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_tell. Expected _wxPyInputStream_p.");
680 return NULL;
681 }
682 }
683 {
684 _result = (int )wxInputStream_tell(_arg0);
685
686 } _resultobj = Py_BuildValue("i",_result);
687 return _resultobj;
688 }
689
690 static void wxOutputStream_write(wxOutputStream *self,const wxString & str) {
691 self->Write(str.c_str(), str.Length());
692 }
693 static PyObject *_wrap_wxOutputStream_write(PyObject *self, PyObject *args, PyObject *kwargs) {
694 PyObject * _resultobj;
695 wxOutputStream * _arg0;
696 wxString * _arg1;
697 PyObject * _argo0 = 0;
698 PyObject * _obj1 = 0;
699 char *_kwnames[] = { "self","str", NULL };
700
701 self = self;
702 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxOutputStream_write",_kwnames,&_argo0,&_obj1))
703 return NULL;
704 if (_argo0) {
705 if (_argo0 == Py_None) { _arg0 = NULL; }
706 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxOutputStream_p")) {
707 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxOutputStream_write. Expected _wxOutputStream_p.");
708 return NULL;
709 }
710 }
711 {
712 #if PYTHON_API_VERSION >= 1009
713 char* tmpPtr; int tmpSize;
714 if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
715 PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
716 return NULL;
717 }
718 if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
719 return NULL;
720 _arg1 = new wxString(tmpPtr, tmpSize);
721 #else
722 if (!PyString_Check(_obj1)) {
723 PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
724 return NULL;
725 }
726 _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
727 #endif
728 }
729 {
730 wxOutputStream_write(_arg0,*_arg1);
731
732 } Py_INCREF(Py_None);
733 _resultobj = Py_None;
734 {
735 if (_obj1)
736 delete _arg1;
737 }
738 return _resultobj;
739 }
740
741 static PyMethodDef streamscMethods[] = {
742 { "wxOutputStream_write", (PyCFunction) _wrap_wxOutputStream_write, METH_VARARGS | METH_KEYWORDS },
743 { "wxInputStream_tell", (PyCFunction) _wrap_wxInputStream_tell, METH_VARARGS | METH_KEYWORDS },
744 { "wxInputStream_seek", (PyCFunction) _wrap_wxInputStream_seek, METH_VARARGS | METH_KEYWORDS },
745 { "wxInputStream_readlines", (PyCFunction) _wrap_wxInputStream_readlines, METH_VARARGS | METH_KEYWORDS },
746 { "wxInputStream_readline", (PyCFunction) _wrap_wxInputStream_readline, METH_VARARGS | METH_KEYWORDS },
747 { "wxInputStream_read", (PyCFunction) _wrap_wxInputStream_read, METH_VARARGS | METH_KEYWORDS },
748 { "wxInputStream_eof", (PyCFunction) _wrap_wxInputStream_eof, METH_VARARGS | METH_KEYWORDS },
749 { "wxInputStream_flush", (PyCFunction) _wrap_wxInputStream_flush, METH_VARARGS | METH_KEYWORDS },
750 { "wxInputStream_close", (PyCFunction) _wrap_wxInputStream_close, METH_VARARGS | METH_KEYWORDS },
751 { "new_wxInputStream", (PyCFunction) _wrap_new_wxInputStream, METH_VARARGS | METH_KEYWORDS },
752 { NULL, NULL }
753 };
754 #ifdef __cplusplus
755 }
756 #endif
757 /*
758 * This table is used by the pointer type-checker
759 */
760 static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
761 { "_signed_long","_long",0},
762 { "_wxPrintQuality","_wxCoord",0},
763 { "_wxPrintQuality","_int",0},
764 { "_wxPrintQuality","_signed_int",0},
765 { "_wxPrintQuality","_unsigned_int",0},
766 { "_wxPrintQuality","_wxWindowID",0},
767 { "_wxPrintQuality","_uint",0},
768 { "_wxPrintQuality","_EBool",0},
769 { "_wxPrintQuality","_size_t",0},
770 { "_wxPrintQuality","_time_t",0},
771 { "_byte","_unsigned_char",0},
772 { "_long","_unsigned_long",0},
773 { "_long","_signed_long",0},
774 { "_size_t","_wxCoord",0},
775 { "_size_t","_wxPrintQuality",0},
776 { "_size_t","_time_t",0},
777 { "_size_t","_unsigned_int",0},
778 { "_size_t","_int",0},
779 { "_size_t","_wxWindowID",0},
780 { "_size_t","_uint",0},
781 { "_uint","_wxCoord",0},
782 { "_uint","_wxPrintQuality",0},
783 { "_uint","_time_t",0},
784 { "_uint","_size_t",0},
785 { "_uint","_unsigned_int",0},
786 { "_uint","_int",0},
787 { "_uint","_wxWindowID",0},
788 { "_wxChar","_char",0},
789 { "_char","_wxChar",0},
790 { "_EBool","_wxCoord",0},
791 { "_EBool","_wxPrintQuality",0},
792 { "_EBool","_signed_int",0},
793 { "_EBool","_int",0},
794 { "_EBool","_wxWindowID",0},
795 { "_unsigned_long","_long",0},
796 { "_wxPyInputStream","_class_wxPyInputStream",0},
797 { "_class_wxOutputStream","_wxOutputStream",0},
798 { "_signed_int","_wxCoord",0},
799 { "_signed_int","_wxPrintQuality",0},
800 { "_signed_int","_EBool",0},
801 { "_signed_int","_wxWindowID",0},
802 { "_signed_int","_int",0},
803 { "_WXTYPE","_short",0},
804 { "_WXTYPE","_signed_short",0},
805 { "_WXTYPE","_unsigned_short",0},
806 { "_unsigned_short","_WXTYPE",0},
807 { "_unsigned_short","_short",0},
808 { "_class_wxPyInputStream","_wxPyInputStream",0},
809 { "_signed_short","_WXTYPE",0},
810 { "_signed_short","_short",0},
811 { "_unsigned_char","_byte",0},
812 { "_unsigned_int","_wxCoord",0},
813 { "_unsigned_int","_wxPrintQuality",0},
814 { "_unsigned_int","_time_t",0},
815 { "_unsigned_int","_size_t",0},
816 { "_unsigned_int","_uint",0},
817 { "_unsigned_int","_wxWindowID",0},
818 { "_unsigned_int","_int",0},
819 { "_short","_WXTYPE",0},
820 { "_short","_unsigned_short",0},
821 { "_short","_signed_short",0},
822 { "_wxWindowID","_wxCoord",0},
823 { "_wxWindowID","_wxPrintQuality",0},
824 { "_wxWindowID","_time_t",0},
825 { "_wxWindowID","_size_t",0},
826 { "_wxWindowID","_EBool",0},
827 { "_wxWindowID","_uint",0},
828 { "_wxWindowID","_int",0},
829 { "_wxWindowID","_signed_int",0},
830 { "_wxWindowID","_unsigned_int",0},
831 { "_int","_wxCoord",0},
832 { "_int","_wxPrintQuality",0},
833 { "_int","_time_t",0},
834 { "_int","_size_t",0},
835 { "_int","_EBool",0},
836 { "_int","_uint",0},
837 { "_int","_wxWindowID",0},
838 { "_int","_unsigned_int",0},
839 { "_int","_signed_int",0},
840 { "_time_t","_wxCoord",0},
841 { "_time_t","_wxPrintQuality",0},
842 { "_time_t","_unsigned_int",0},
843 { "_time_t","_int",0},
844 { "_time_t","_wxWindowID",0},
845 { "_time_t","_uint",0},
846 { "_time_t","_size_t",0},
847 { "_wxCoord","_int",0},
848 { "_wxCoord","_signed_int",0},
849 { "_wxCoord","_unsigned_int",0},
850 { "_wxCoord","_wxWindowID",0},
851 { "_wxCoord","_uint",0},
852 { "_wxCoord","_EBool",0},
853 { "_wxCoord","_size_t",0},
854 { "_wxCoord","_time_t",0},
855 { "_wxCoord","_wxPrintQuality",0},
856 { "_wxOutputStream","_class_wxOutputStream",0},
857 {0,0,0}};
858
859 static PyObject *SWIG_globals;
860 #ifdef __cplusplus
861 extern "C"
862 #endif
863 SWIGEXPORT(void) initstreamsc() {
864 PyObject *m, *d;
865 SWIG_globals = SWIG_newvarlink();
866 m = Py_InitModule("streamsc", streamscMethods);
867 d = PyModule_GetDict(m);
868 {
869 int i;
870 for (i = 0; _swig_mapping[i].n1; i++)
871 SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
872 }
873 }