]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/gtk/streams.cpp
test commit, no real change
[wxWidgets.git] / wxPython / src / gtk / streams.cpp
CommitLineData
c368d904
RD
1/*
2 * FILE : src/gtk/streams.cpp
3 *
4 * This file was automatically generated by :
5 * Simplified Wrapper and Interface Generator (SWIG)
2cd2fac8 6 * Version 1.1 (Build 883)
c368d904
RD
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
42extern "C" {
43#endif
2cd2fac8 44
c368d904
RD
45extern void SWIG_MakePtr(char *, void *, char *);
46extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
47extern char *SWIG_GetPtr(char *, void **, char *);
48extern char *SWIG_GetPtrObj(PyObject *, void **, char *);
49extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
50extern 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
62static PyObject* l_output_helper(PyObject* target, PyObject* o) {
63 PyObject* o2;
2cd2fac8 64 if (!target) {
c368d904 65 target = o;
2cd2fac8 66 } else if (target == Py_None) {
c368d904
RD
67 Py_DECREF(Py_None);
68 target = o;
2cd2fac8 69 } else {
c368d904
RD
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
82static PyObject* t_output_helper(PyObject* target, PyObject* o) {
83 PyObject* o2;
84 PyObject* o3;
85
2cd2fac8 86 if (!target) {
c368d904 87 target = o;
2cd2fac8 88 } else if (target == Py_None) {
c368d904
RD
89 Py_DECREF(Py_None);
90 target = o;
2cd2fac8 91 } else {
c368d904
RD
92 if (!PyTuple_Check(target)) {
93 o2 = target;
94 target = PyTuple_New(1);
95 PyTuple_SetItem(target, 0, o2);
96 }
2cd2fac8
RD
97 o3 = PyTuple_New(1);
98 PyTuple_SetItem(o3, 0, o);
c368d904
RD
99
100 o2 = target;
2cd2fac8
RD
101 target = PySequence_Concat(o2, o3);
102 Py_DECREF(o2);
c368d904
RD
103 Py_DECREF(o3);
104 }
105 return target;
106}
107
108static char* wxStringErrorMsg = "string type is required for parameter";
109 // C++
110// definitions of wxStringPtrList and wxPyInputStream
111#include <wx/listimpl.cpp>
112WX_DEFINE_LIST(wxStringPtrList);
113
114
115void wxPyInputStream::close() {
116 /* do nothing */
117}
118
119void wxPyInputStream::flush() {
120 /*do nothing*/
121}
122
123bool wxPyInputStream::eof() {
124 if (wxi)
125 return wxi->Eof();
126 else
127 return TRUE;
128}
129
130wxPyInputStream::~wxPyInputStream() {
131 /*do nothing*/
132}
133
134wxString* 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
200wxString* 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
233wxStringPtrList* 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
273void wxPyInputStream::seek(int offset, int whence) {
274 if (wxi)
275 wxi->SeekI(offset, wxSeekMode(whence));
276}
277
278int wxPyInputStream::tell(){
279 if (wxi)
280 return wxi->TellI();
281}
282
283
284
285// wxInputStream which operates on a Python file-like object
286class wxPyCBInputStream : public wxInputStream {
287protected:
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
353public:
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);
2cd2fac8
RD
403 if (!PyMethod_Check(o) && !PyCFunction_Check(o)) {
404 Py_DECREF(o);
c368d904 405 return NULL;
2cd2fac8 406 }
c368d904
RD
407 return o;
408 }
409
410protected:
411
412};
413
414#ifdef __cplusplus
415extern "C" {
416#endif
417static wxPyInputStream *new_wxPyInputStream(PyObject *p) {
418 wxInputStream* wxi = wxPyCBInputStream::create(p);
419 if (wxi)
420 return new wxPyInputStream(wxi);
421 else
422 return NULL;
423 }
424
425static PyObject *_wrap_new_wxInputStream(PyObject *self, PyObject *args, PyObject *kwargs) {
426 PyObject * _resultobj;
427 wxPyInputStream * _result;
428 PyObject * _arg0;
429 PyObject * _obj0 = 0;
430 char *_kwnames[] = { "p", NULL };
431
432 self = self;
433 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:new_wxInputStream",_kwnames,&_obj0))
434 return NULL;
435{
436 _arg0 = _obj0;
437}
438{
439 _result = (wxPyInputStream *)new_wxPyInputStream(_arg0);
440
441}{
442 char _ptemp[128];
443 if (_result) {
444 SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyInputStream_p");
445 _resultobj = Py_BuildValue("s",_ptemp);
446 }
447 else
448 _resultobj=0;
449}
450 return _resultobj;
451}
452
453#define wxInputStream_close(_swigobj) (_swigobj->close())
454static PyObject *_wrap_wxInputStream_close(PyObject *self, PyObject *args, PyObject *kwargs) {
455 PyObject * _resultobj;
456 wxPyInputStream * _arg0;
457 PyObject * _argo0 = 0;
458 char *_kwnames[] = { "self", NULL };
459
460 self = self;
461 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_close",_kwnames,&_argo0))
462 return NULL;
463 if (_argo0) {
464 if (_argo0 == Py_None) { _arg0 = NULL; }
465 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
466 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_close. Expected _wxPyInputStream_p.");
467 return NULL;
468 }
469 }
470{
471 wxInputStream_close(_arg0);
472
473} Py_INCREF(Py_None);
474 _resultobj = Py_None;
475 return _resultobj;
476}
477
478#define wxInputStream_flush(_swigobj) (_swigobj->flush())
479static PyObject *_wrap_wxInputStream_flush(PyObject *self, PyObject *args, PyObject *kwargs) {
480 PyObject * _resultobj;
481 wxPyInputStream * _arg0;
482 PyObject * _argo0 = 0;
483 char *_kwnames[] = { "self", NULL };
484
485 self = self;
486 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_flush",_kwnames,&_argo0))
487 return NULL;
488 if (_argo0) {
489 if (_argo0 == Py_None) { _arg0 = NULL; }
490 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
491 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_flush. Expected _wxPyInputStream_p.");
492 return NULL;
493 }
494 }
495{
496 wxInputStream_flush(_arg0);
497
498} Py_INCREF(Py_None);
499 _resultobj = Py_None;
500 return _resultobj;
501}
502
503#define wxInputStream_eof(_swigobj) (_swigobj->eof())
504static PyObject *_wrap_wxInputStream_eof(PyObject *self, PyObject *args, PyObject *kwargs) {
505 PyObject * _resultobj;
506 bool _result;
507 wxPyInputStream * _arg0;
508 PyObject * _argo0 = 0;
509 char *_kwnames[] = { "self", NULL };
510
511 self = self;
512 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_eof",_kwnames,&_argo0))
513 return NULL;
514 if (_argo0) {
515 if (_argo0 == Py_None) { _arg0 = NULL; }
516 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
517 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_eof. Expected _wxPyInputStream_p.");
518 return NULL;
519 }
520 }
521{
522 _result = (bool )wxInputStream_eof(_arg0);
523
524} _resultobj = Py_BuildValue("i",_result);
525 return _resultobj;
526}
527
528#define wxInputStream_read(_swigobj,_swigarg0) (_swigobj->read(_swigarg0))
529static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObject *kwargs) {
530 PyObject * _resultobj;
531 wxString * _result;
532 wxPyInputStream * _arg0;
533 int _arg1 = (int ) -1;
534 PyObject * _argo0 = 0;
535 char *_kwnames[] = { "self","size", NULL };
536
537 self = self;
538 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_read",_kwnames,&_argo0,&_arg1))
539 return NULL;
540 if (_argo0) {
541 if (_argo0 == Py_None) { _arg0 = NULL; }
542 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
543 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_read. Expected _wxPyInputStream_p.");
544 return NULL;
545 }
546 }
547{
548 _result = (wxString *)wxInputStream_read(_arg0,_arg1);
549
550}{
551 if (_result) {
552 _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
553 delete _result;
554 }
555 else
556 _resultobj=0;
557}
558 return _resultobj;
559}
560
561#define wxInputStream_readline(_swigobj,_swigarg0) (_swigobj->readline(_swigarg0))
562static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, PyObject *kwargs) {
563 PyObject * _resultobj;
564 wxString * _result;
565 wxPyInputStream * _arg0;
566 int _arg1 = (int ) -1;
567 PyObject * _argo0 = 0;
568 char *_kwnames[] = { "self","size", NULL };
569
570 self = self;
571 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_readline",_kwnames,&_argo0,&_arg1))
572 return NULL;
573 if (_argo0) {
574 if (_argo0 == Py_None) { _arg0 = NULL; }
575 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
576 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_readline. Expected _wxPyInputStream_p.");
577 return NULL;
578 }
579 }
580{
581 _result = (wxString *)wxInputStream_readline(_arg0,_arg1);
582
583}{
584 if (_result) {
585 _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
586 delete _result;
587 }
588 else
589 _resultobj=0;
590}
591 return _resultobj;
592}
593
594#define wxInputStream_readlines(_swigobj,_swigarg0) (_swigobj->readlines(_swigarg0))
595static PyObject *_wrap_wxInputStream_readlines(PyObject *self, PyObject *args, PyObject *kwargs) {
596 PyObject * _resultobj;
597 wxStringPtrList * _result;
598 wxPyInputStream * _arg0;
599 int _arg1 = (int ) -1;
600 PyObject * _argo0 = 0;
601 char *_kwnames[] = { "self","sizehint", NULL };
602
603 self = self;
604 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_readlines",_kwnames,&_argo0,&_arg1))
605 return NULL;
606 if (_argo0) {
607 if (_argo0 == Py_None) { _arg0 = NULL; }
608 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
609 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_readlines. Expected _wxPyInputStream_p.");
610 return NULL;
611 }
612 }
613{
614 _result = (wxStringPtrList *)wxInputStream_readlines(_arg0,_arg1);
615
616}{
617 if (_result) {
618 _resultobj = PyList_New(_result->GetCount());
619 wxStringPtrList::Node *node = _result->GetFirst();
620 for (int i=0; node; i++) {
621 wxString *s = node->GetData();
622 PyList_SetItem(_resultobj, i, PyString_FromStringAndSize(s->c_str(), s->Len()));
623 node = node->GetNext();
624 delete s;
625 }
626 delete _result;
627 }
628 else
629 _resultobj=0;
630}
631 return _resultobj;
632}
633
634#define wxInputStream_seek(_swigobj,_swigarg0,_swigarg1) (_swigobj->seek(_swigarg0,_swigarg1))
635static PyObject *_wrap_wxInputStream_seek(PyObject *self, PyObject *args, PyObject *kwargs) {
636 PyObject * _resultobj;
637 wxPyInputStream * _arg0;
638 int _arg1;
639 int _arg2 = (int ) 0;
640 PyObject * _argo0 = 0;
641 char *_kwnames[] = { "self","offset","whence", NULL };
642
643 self = self;
644 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxInputStream_seek",_kwnames,&_argo0,&_arg1,&_arg2))
645 return NULL;
646 if (_argo0) {
647 if (_argo0 == Py_None) { _arg0 = NULL; }
648 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
649 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_seek. Expected _wxPyInputStream_p.");
650 return NULL;
651 }
652 }
653{
654 wxInputStream_seek(_arg0,_arg1,_arg2);
655
656} Py_INCREF(Py_None);
657 _resultobj = Py_None;
658 return _resultobj;
659}
660
661#define wxInputStream_tell(_swigobj) (_swigobj->tell())
662static PyObject *_wrap_wxInputStream_tell(PyObject *self, PyObject *args, PyObject *kwargs) {
663 PyObject * _resultobj;
664 int _result;
665 wxPyInputStream * _arg0;
666 PyObject * _argo0 = 0;
667 char *_kwnames[] = { "self", NULL };
668
669 self = self;
670 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_tell",_kwnames,&_argo0))
671 return NULL;
672 if (_argo0) {
673 if (_argo0 == Py_None) { _arg0 = NULL; }
674 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
675 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_tell. Expected _wxPyInputStream_p.");
676 return NULL;
677 }
678 }
679{
680 _result = (int )wxInputStream_tell(_arg0);
681
682} _resultobj = Py_BuildValue("i",_result);
683 return _resultobj;
684}
685
686static void wxOutputStream_write(wxOutputStream *self,const wxString & str) {
687 self->Write(str.c_str(), str.Length());
688 }
689static PyObject *_wrap_wxOutputStream_write(PyObject *self, PyObject *args, PyObject *kwargs) {
690 PyObject * _resultobj;
691 wxOutputStream * _arg0;
692 wxString * _arg1;
693 PyObject * _argo0 = 0;
694 PyObject * _obj1 = 0;
695 char *_kwnames[] = { "self","str", NULL };
696
697 self = self;
698 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxOutputStream_write",_kwnames,&_argo0,&_obj1))
699 return NULL;
700 if (_argo0) {
701 if (_argo0 == Py_None) { _arg0 = NULL; }
702 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxOutputStream_p")) {
703 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxOutputStream_write. Expected _wxOutputStream_p.");
704 return NULL;
705 }
706 }
707{
2cd2fac8
RD
708#if PYTHON_API_VERSION >= 1009
709 char* tmpPtr; int tmpSize;
710 if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
711 PyErr_SetString(PyExc_TypeError, "String or Unicode type required");
712 return NULL;
713 }
714 if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
715 return NULL;
716 _arg1 = new wxString(tmpPtr, tmpSize);
717#else
c368d904
RD
718 if (!PyString_Check(_obj1)) {
719 PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
720 return NULL;
721 }
2cd2fac8
RD
722 _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
723#endif
c368d904
RD
724}
725{
726 wxOutputStream_write(_arg0,*_arg1);
727
728} Py_INCREF(Py_None);
729 _resultobj = Py_None;
730{
731 if (_obj1)
732 delete _arg1;
733}
734 return _resultobj;
735}
736
737static PyMethodDef streamscMethods[] = {
738 { "wxOutputStream_write", (PyCFunction) _wrap_wxOutputStream_write, METH_VARARGS | METH_KEYWORDS },
739 { "wxInputStream_tell", (PyCFunction) _wrap_wxInputStream_tell, METH_VARARGS | METH_KEYWORDS },
740 { "wxInputStream_seek", (PyCFunction) _wrap_wxInputStream_seek, METH_VARARGS | METH_KEYWORDS },
741 { "wxInputStream_readlines", (PyCFunction) _wrap_wxInputStream_readlines, METH_VARARGS | METH_KEYWORDS },
742 { "wxInputStream_readline", (PyCFunction) _wrap_wxInputStream_readline, METH_VARARGS | METH_KEYWORDS },
743 { "wxInputStream_read", (PyCFunction) _wrap_wxInputStream_read, METH_VARARGS | METH_KEYWORDS },
744 { "wxInputStream_eof", (PyCFunction) _wrap_wxInputStream_eof, METH_VARARGS | METH_KEYWORDS },
745 { "wxInputStream_flush", (PyCFunction) _wrap_wxInputStream_flush, METH_VARARGS | METH_KEYWORDS },
746 { "wxInputStream_close", (PyCFunction) _wrap_wxInputStream_close, METH_VARARGS | METH_KEYWORDS },
747 { "new_wxInputStream", (PyCFunction) _wrap_new_wxInputStream, METH_VARARGS | METH_KEYWORDS },
748 { NULL, NULL }
749};
750#ifdef __cplusplus
751}
752#endif
753/*
754 * This table is used by the pointer type-checker
755 */
756static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
757 { "_signed_long","_long",0},
758 { "_wxPrintQuality","_wxCoord",0},
759 { "_wxPrintQuality","_int",0},
760 { "_wxPrintQuality","_signed_int",0},
761 { "_wxPrintQuality","_unsigned_int",0},
762 { "_wxPrintQuality","_wxWindowID",0},
763 { "_wxPrintQuality","_uint",0},
764 { "_wxPrintQuality","_EBool",0},
765 { "_wxPrintQuality","_size_t",0},
766 { "_wxPrintQuality","_time_t",0},
767 { "_byte","_unsigned_char",0},
768 { "_long","_unsigned_long",0},
769 { "_long","_signed_long",0},
770 { "_size_t","_wxCoord",0},
771 { "_size_t","_wxPrintQuality",0},
772 { "_size_t","_time_t",0},
773 { "_size_t","_unsigned_int",0},
774 { "_size_t","_int",0},
775 { "_size_t","_wxWindowID",0},
776 { "_size_t","_uint",0},
777 { "_uint","_wxCoord",0},
778 { "_uint","_wxPrintQuality",0},
779 { "_uint","_time_t",0},
780 { "_uint","_size_t",0},
781 { "_uint","_unsigned_int",0},
782 { "_uint","_int",0},
783 { "_uint","_wxWindowID",0},
784 { "_wxChar","_char",0},
785 { "_char","_wxChar",0},
786 { "_EBool","_wxCoord",0},
787 { "_EBool","_wxPrintQuality",0},
788 { "_EBool","_signed_int",0},
789 { "_EBool","_int",0},
790 { "_EBool","_wxWindowID",0},
791 { "_unsigned_long","_long",0},
792 { "_wxPyInputStream","_class_wxPyInputStream",0},
793 { "_class_wxOutputStream","_wxOutputStream",0},
794 { "_signed_int","_wxCoord",0},
795 { "_signed_int","_wxPrintQuality",0},
796 { "_signed_int","_EBool",0},
797 { "_signed_int","_wxWindowID",0},
798 { "_signed_int","_int",0},
799 { "_WXTYPE","_short",0},
800 { "_WXTYPE","_signed_short",0},
801 { "_WXTYPE","_unsigned_short",0},
802 { "_unsigned_short","_WXTYPE",0},
803 { "_unsigned_short","_short",0},
804 { "_class_wxPyInputStream","_wxPyInputStream",0},
805 { "_signed_short","_WXTYPE",0},
806 { "_signed_short","_short",0},
807 { "_unsigned_char","_byte",0},
808 { "_unsigned_int","_wxCoord",0},
809 { "_unsigned_int","_wxPrintQuality",0},
810 { "_unsigned_int","_time_t",0},
811 { "_unsigned_int","_size_t",0},
812 { "_unsigned_int","_uint",0},
813 { "_unsigned_int","_wxWindowID",0},
814 { "_unsigned_int","_int",0},
815 { "_short","_WXTYPE",0},
816 { "_short","_unsigned_short",0},
817 { "_short","_signed_short",0},
818 { "_wxWindowID","_wxCoord",0},
819 { "_wxWindowID","_wxPrintQuality",0},
820 { "_wxWindowID","_time_t",0},
821 { "_wxWindowID","_size_t",0},
822 { "_wxWindowID","_EBool",0},
823 { "_wxWindowID","_uint",0},
824 { "_wxWindowID","_int",0},
825 { "_wxWindowID","_signed_int",0},
826 { "_wxWindowID","_unsigned_int",0},
827 { "_int","_wxCoord",0},
828 { "_int","_wxPrintQuality",0},
829 { "_int","_time_t",0},
830 { "_int","_size_t",0},
831 { "_int","_EBool",0},
832 { "_int","_uint",0},
833 { "_int","_wxWindowID",0},
834 { "_int","_unsigned_int",0},
835 { "_int","_signed_int",0},
836 { "_time_t","_wxCoord",0},
837 { "_time_t","_wxPrintQuality",0},
838 { "_time_t","_unsigned_int",0},
839 { "_time_t","_int",0},
840 { "_time_t","_wxWindowID",0},
841 { "_time_t","_uint",0},
842 { "_time_t","_size_t",0},
843 { "_wxCoord","_int",0},
844 { "_wxCoord","_signed_int",0},
845 { "_wxCoord","_unsigned_int",0},
846 { "_wxCoord","_wxWindowID",0},
847 { "_wxCoord","_uint",0},
848 { "_wxCoord","_EBool",0},
849 { "_wxCoord","_size_t",0},
850 { "_wxCoord","_time_t",0},
851 { "_wxCoord","_wxPrintQuality",0},
852 { "_wxOutputStream","_class_wxOutputStream",0},
853{0,0,0}};
854
855static PyObject *SWIG_globals;
856#ifdef __cplusplus
857extern "C"
858#endif
859SWIGEXPORT(void) initstreamsc() {
860 PyObject *m, *d;
861 SWIG_globals = SWIG_newvarlink();
862 m = Py_InitModule("streamsc", streamscMethods);
863 d = PyModule_GetDict(m);
864{
865 int i;
866 for (i = 0; _swig_mapping[i].n1; i++)
867 SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
868}
869}