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