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