]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/gtk/streams.cpp
Applied and merged patch 486364, which enables wxPython to be built in
[wxWidgets.git] / wxPython / src / gtk / streams.cpp
1 /*
2 * FILE : src/gtk/streams.cpp
3 *
4 * This file was automatically generated by :
5 * Simplified Wrapper and Interface Generator (SWIG)
6 * Version 1.1 (Build 883)
7 *
8 * Portions Copyright (c) 1995-1998
9 * The University of Utah and The Regents of the University of California.
10 * Permission is granted to distribute this file in any manner provided
11 * this notice remains intact.
12 *
13 * Do not make changes to this file--changes will be lost!
14 *
15 */
16
17
18 #define SWIGCODE
19 /* Implementation : PYTHON */
20
21 #define SWIGPYTHON
22 #include <string.h>
23 #include <stdlib.h>
24 /* Definitions for Windows/Unix exporting */
25 #if defined(__WIN32__)
26 # if defined(_MSC_VER)
27 # define SWIGEXPORT(a) __declspec(dllexport) a
28 # else
29 # if defined(__BORLANDC__)
30 # define SWIGEXPORT(a) a _export
31 # else
32 # define SWIGEXPORT(a) a
33 # endif
34 # endif
35 #else
36 # define SWIGEXPORT(a) a
37 #endif
38
39 #include "Python.h"
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 extern void SWIG_MakePtr(char *, void *, char *);
46 extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
47 extern char *SWIG_GetPtr(char *, void **, char *);
48 extern char *SWIG_GetPtrObj(PyObject *, void **, char *);
49 extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
50 extern PyObject *SWIG_newvarlink(void);
51 #ifdef __cplusplus
52 }
53 #endif
54 #define SWIG_init initstreamsc
55
56 #define SWIG_name "streamsc"
57
58 #include "helpers.h"
59 #include "pyistream.h"
60 #include <wx/stream.h>
61 #include <wx/list.h>
62
63
64 static PyObject* t_output_helper(PyObject* target, PyObject* o) {
65 PyObject* o2;
66 PyObject* o3;
67
68 if (!target) {
69 target = o;
70 } else if (target == Py_None) {
71 Py_DECREF(Py_None);
72 target = o;
73 } else {
74 if (!PyTuple_Check(target)) {
75 o2 = target;
76 target = PyTuple_New(1);
77 PyTuple_SetItem(target, 0, o2);
78 }
79 o3 = PyTuple_New(1);
80 PyTuple_SetItem(o3, 0, o);
81
82 o2 = target;
83 target = PySequence_Concat(o2, o3);
84 Py_DECREF(o2);
85 Py_DECREF(o3);
86 }
87 return target;
88 }
89 #ifdef __cplusplus
90 extern "C" {
91 #endif
92 static wxPyInputStream *new_wxPyInputStream(PyObject *p) {
93 wxInputStream* wxis = wxPyCBInputStream::create(p);
94 if (wxis)
95 return new wxPyInputStream(wxis);
96 else
97 return NULL;
98 }
99
100 static PyObject *_wrap_new_wxInputStream(PyObject *self, PyObject *args, PyObject *kwargs) {
101 PyObject * _resultobj;
102 wxPyInputStream * _result;
103 PyObject * _arg0;
104 PyObject * _obj0 = 0;
105 char *_kwnames[] = { "p", NULL };
106 char _ptemp[128];
107
108 self = self;
109 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:new_wxInputStream",_kwnames,&_obj0))
110 return NULL;
111 {
112 _arg0 = _obj0;
113 }
114 {
115 PyThreadState* __tstate = wxPyBeginAllowThreads();
116 _result = (wxPyInputStream *)new_wxPyInputStream(_arg0);
117
118 wxPyEndAllowThreads(__tstate);
119 if (PyErr_Occurred()) return NULL;
120 } if (_result) {
121 SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyInputStream_p");
122 _resultobj = Py_BuildValue("s",_ptemp);
123 } else {
124 Py_INCREF(Py_None);
125 _resultobj = Py_None;
126 }
127 return _resultobj;
128 }
129
130 #define wxInputStream_close(_swigobj) (_swigobj->close())
131 static PyObject *_wrap_wxInputStream_close(PyObject *self, PyObject *args, PyObject *kwargs) {
132 PyObject * _resultobj;
133 wxPyInputStream * _arg0;
134 PyObject * _argo0 = 0;
135 char *_kwnames[] = { "self", NULL };
136
137 self = self;
138 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_close",_kwnames,&_argo0))
139 return NULL;
140 if (_argo0) {
141 if (_argo0 == Py_None) { _arg0 = NULL; }
142 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
143 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_close. Expected _wxPyInputStream_p.");
144 return NULL;
145 }
146 }
147 {
148 PyThreadState* __tstate = wxPyBeginAllowThreads();
149 wxInputStream_close(_arg0);
150
151 wxPyEndAllowThreads(__tstate);
152 if (PyErr_Occurred()) return NULL;
153 } Py_INCREF(Py_None);
154 _resultobj = Py_None;
155 return _resultobj;
156 }
157
158 #define wxInputStream_flush(_swigobj) (_swigobj->flush())
159 static PyObject *_wrap_wxInputStream_flush(PyObject *self, PyObject *args, PyObject *kwargs) {
160 PyObject * _resultobj;
161 wxPyInputStream * _arg0;
162 PyObject * _argo0 = 0;
163 char *_kwnames[] = { "self", NULL };
164
165 self = self;
166 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_flush",_kwnames,&_argo0))
167 return NULL;
168 if (_argo0) {
169 if (_argo0 == Py_None) { _arg0 = NULL; }
170 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
171 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_flush. Expected _wxPyInputStream_p.");
172 return NULL;
173 }
174 }
175 {
176 PyThreadState* __tstate = wxPyBeginAllowThreads();
177 wxInputStream_flush(_arg0);
178
179 wxPyEndAllowThreads(__tstate);
180 if (PyErr_Occurred()) return NULL;
181 } Py_INCREF(Py_None);
182 _resultobj = Py_None;
183 return _resultobj;
184 }
185
186 #define wxInputStream_eof(_swigobj) (_swigobj->eof())
187 static PyObject *_wrap_wxInputStream_eof(PyObject *self, PyObject *args, PyObject *kwargs) {
188 PyObject * _resultobj;
189 bool _result;
190 wxPyInputStream * _arg0;
191 PyObject * _argo0 = 0;
192 char *_kwnames[] = { "self", NULL };
193
194 self = self;
195 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_eof",_kwnames,&_argo0))
196 return NULL;
197 if (_argo0) {
198 if (_argo0 == Py_None) { _arg0 = NULL; }
199 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
200 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_eof. Expected _wxPyInputStream_p.");
201 return NULL;
202 }
203 }
204 {
205 PyThreadState* __tstate = wxPyBeginAllowThreads();
206 _result = (bool )wxInputStream_eof(_arg0);
207
208 wxPyEndAllowThreads(__tstate);
209 if (PyErr_Occurred()) return NULL;
210 } _resultobj = Py_BuildValue("i",_result);
211 return _resultobj;
212 }
213
214 #define wxInputStream_read(_swigobj,_swigarg0) (_swigobj->read(_swigarg0))
215 static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObject *kwargs) {
216 PyObject * _resultobj;
217 wxString * _result;
218 wxPyInputStream * _arg0;
219 int _arg1 = (int ) -1;
220 PyObject * _argo0 = 0;
221 char *_kwnames[] = { "self","size", NULL };
222
223 self = self;
224 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_read",_kwnames,&_argo0,&_arg1))
225 return NULL;
226 if (_argo0) {
227 if (_argo0 == Py_None) { _arg0 = NULL; }
228 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
229 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_read. Expected _wxPyInputStream_p.");
230 return NULL;
231 }
232 }
233 {
234 PyThreadState* __tstate = wxPyBeginAllowThreads();
235 _result = (wxString *)wxInputStream_read(_arg0,_arg1);
236
237 wxPyEndAllowThreads(__tstate);
238 if (PyErr_Occurred()) return NULL;
239 }{
240 #if wxUSE_UNICODE
241 _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
242 #else
243 _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
244 #endif
245 }
246 return _resultobj;
247 }
248
249 #define wxInputStream_readline(_swigobj,_swigarg0) (_swigobj->readline(_swigarg0))
250 static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, PyObject *kwargs) {
251 PyObject * _resultobj;
252 wxString * _result;
253 wxPyInputStream * _arg0;
254 int _arg1 = (int ) -1;
255 PyObject * _argo0 = 0;
256 char *_kwnames[] = { "self","size", NULL };
257
258 self = self;
259 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_readline",_kwnames,&_argo0,&_arg1))
260 return NULL;
261 if (_argo0) {
262 if (_argo0 == Py_None) { _arg0 = NULL; }
263 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
264 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_readline. Expected _wxPyInputStream_p.");
265 return NULL;
266 }
267 }
268 {
269 PyThreadState* __tstate = wxPyBeginAllowThreads();
270 _result = (wxString *)wxInputStream_readline(_arg0,_arg1);
271
272 wxPyEndAllowThreads(__tstate);
273 if (PyErr_Occurred()) return NULL;
274 }{
275 #if wxUSE_UNICODE
276 _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
277 #else
278 _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
279 #endif
280 }
281 return _resultobj;
282 }
283
284 #define wxInputStream_readlines(_swigobj,_swigarg0) (_swigobj->readlines(_swigarg0))
285 static PyObject *_wrap_wxInputStream_readlines(PyObject *self, PyObject *args, PyObject *kwargs) {
286 PyObject * _resultobj;
287 wxStringPtrList * _result;
288 wxPyInputStream * _arg0;
289 int _arg1 = (int ) -1;
290 PyObject * _argo0 = 0;
291 char *_kwnames[] = { "self","sizehint", NULL };
292
293 self = self;
294 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_readlines",_kwnames,&_argo0,&_arg1))
295 return NULL;
296 if (_argo0) {
297 if (_argo0 == Py_None) { _arg0 = NULL; }
298 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
299 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_readlines. Expected _wxPyInputStream_p.");
300 return NULL;
301 }
302 }
303 {
304 PyThreadState* __tstate = wxPyBeginAllowThreads();
305 _result = (wxStringPtrList *)wxInputStream_readlines(_arg0,_arg1);
306
307 wxPyEndAllowThreads(__tstate);
308 if (PyErr_Occurred()) return NULL;
309 }{
310 if (_result) {
311 _resultobj = PyList_New(_result->GetCount());
312 wxStringPtrList::Node *node = _result->GetFirst();
313 for (int i=0; node; i++) {
314 wxString *s = node->GetData();
315 #if wxUSE_UNICODE
316 PyList_SetItem(_resultobj, i, PyUnicode_FromUnicode(s->c_str(), s->Len()));
317 #else
318 PyList_SetItem(_resultobj, i, PyString_FromStringAndSize(s->c_str(), s->Len()));
319 #endif
320 node = node->GetNext();
321 delete s;
322 }
323 delete _result;
324 }
325 else
326 _resultobj=0;
327 }
328 return _resultobj;
329 }
330
331 #define wxInputStream_seek(_swigobj,_swigarg0,_swigarg1) (_swigobj->seek(_swigarg0,_swigarg1))
332 static PyObject *_wrap_wxInputStream_seek(PyObject *self, PyObject *args, PyObject *kwargs) {
333 PyObject * _resultobj;
334 wxPyInputStream * _arg0;
335 int _arg1;
336 int _arg2 = (int ) 0;
337 PyObject * _argo0 = 0;
338 char *_kwnames[] = { "self","offset","whence", NULL };
339
340 self = self;
341 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxInputStream_seek",_kwnames,&_argo0,&_arg1,&_arg2))
342 return NULL;
343 if (_argo0) {
344 if (_argo0 == Py_None) { _arg0 = NULL; }
345 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
346 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_seek. Expected _wxPyInputStream_p.");
347 return NULL;
348 }
349 }
350 {
351 PyThreadState* __tstate = wxPyBeginAllowThreads();
352 wxInputStream_seek(_arg0,_arg1,_arg2);
353
354 wxPyEndAllowThreads(__tstate);
355 if (PyErr_Occurred()) return NULL;
356 } Py_INCREF(Py_None);
357 _resultobj = Py_None;
358 return _resultobj;
359 }
360
361 #define wxInputStream_tell(_swigobj) (_swigobj->tell())
362 static PyObject *_wrap_wxInputStream_tell(PyObject *self, PyObject *args, PyObject *kwargs) {
363 PyObject * _resultobj;
364 int _result;
365 wxPyInputStream * _arg0;
366 PyObject * _argo0 = 0;
367 char *_kwnames[] = { "self", NULL };
368
369 self = self;
370 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_tell",_kwnames,&_argo0))
371 return NULL;
372 if (_argo0) {
373 if (_argo0 == Py_None) { _arg0 = NULL; }
374 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
375 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_tell. Expected _wxPyInputStream_p.");
376 return NULL;
377 }
378 }
379 {
380 PyThreadState* __tstate = wxPyBeginAllowThreads();
381 _result = (int )wxInputStream_tell(_arg0);
382
383 wxPyEndAllowThreads(__tstate);
384 if (PyErr_Occurred()) return NULL;
385 } _resultobj = Py_BuildValue("i",_result);
386 return _resultobj;
387 }
388
389 static void wxOutputStream_write(wxOutputStream *self,const wxString & str) {
390 self->Write(str.c_str(), str.Length());
391 }
392 static PyObject *_wrap_wxOutputStream_write(PyObject *self, PyObject *args, PyObject *kwargs) {
393 PyObject * _resultobj;
394 wxOutputStream * _arg0;
395 wxString * _arg1;
396 PyObject * _argo0 = 0;
397 PyObject * _obj1 = 0;
398 char *_kwnames[] = { "self","str", NULL };
399
400 self = self;
401 if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxOutputStream_write",_kwnames,&_argo0,&_obj1))
402 return NULL;
403 if (_argo0) {
404 if (_argo0 == Py_None) { _arg0 = NULL; }
405 else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxOutputStream_p")) {
406 PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxOutputStream_write. Expected _wxOutputStream_p.");
407 return NULL;
408 }
409 }
410 {
411 _arg1 = wxString_in_helper(_obj1);
412 if (_arg1 == NULL)
413 return NULL;
414 }
415 {
416 PyThreadState* __tstate = wxPyBeginAllowThreads();
417 wxOutputStream_write(_arg0,*_arg1);
418
419 wxPyEndAllowThreads(__tstate);
420 if (PyErr_Occurred()) return NULL;
421 } Py_INCREF(Py_None);
422 _resultobj = Py_None;
423 {
424 if (_obj1)
425 delete _arg1;
426 }
427 return _resultobj;
428 }
429
430 static PyMethodDef streamscMethods[] = {
431 { "wxOutputStream_write", (PyCFunction) _wrap_wxOutputStream_write, METH_VARARGS | METH_KEYWORDS },
432 { "wxInputStream_tell", (PyCFunction) _wrap_wxInputStream_tell, METH_VARARGS | METH_KEYWORDS },
433 { "wxInputStream_seek", (PyCFunction) _wrap_wxInputStream_seek, METH_VARARGS | METH_KEYWORDS },
434 { "wxInputStream_readlines", (PyCFunction) _wrap_wxInputStream_readlines, METH_VARARGS | METH_KEYWORDS },
435 { "wxInputStream_readline", (PyCFunction) _wrap_wxInputStream_readline, METH_VARARGS | METH_KEYWORDS },
436 { "wxInputStream_read", (PyCFunction) _wrap_wxInputStream_read, METH_VARARGS | METH_KEYWORDS },
437 { "wxInputStream_eof", (PyCFunction) _wrap_wxInputStream_eof, METH_VARARGS | METH_KEYWORDS },
438 { "wxInputStream_flush", (PyCFunction) _wrap_wxInputStream_flush, METH_VARARGS | METH_KEYWORDS },
439 { "wxInputStream_close", (PyCFunction) _wrap_wxInputStream_close, METH_VARARGS | METH_KEYWORDS },
440 { "new_wxInputStream", (PyCFunction) _wrap_new_wxInputStream, METH_VARARGS | METH_KEYWORDS },
441 { NULL, NULL }
442 };
443 #ifdef __cplusplus
444 }
445 #endif
446 /*
447 * This table is used by the pointer type-checker
448 */
449 static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
450 { "_signed_long","_long",0},
451 { "_wxPrintQuality","_wxCoord",0},
452 { "_wxPrintQuality","_int",0},
453 { "_wxPrintQuality","_signed_int",0},
454 { "_wxPrintQuality","_unsigned_int",0},
455 { "_wxPrintQuality","_wxWindowID",0},
456 { "_wxPrintQuality","_uint",0},
457 { "_wxPrintQuality","_EBool",0},
458 { "_wxPrintQuality","_size_t",0},
459 { "_wxPrintQuality","_time_t",0},
460 { "_byte","_unsigned_char",0},
461 { "_long","_unsigned_long",0},
462 { "_long","_signed_long",0},
463 { "_size_t","_wxCoord",0},
464 { "_size_t","_wxPrintQuality",0},
465 { "_size_t","_time_t",0},
466 { "_size_t","_unsigned_int",0},
467 { "_size_t","_int",0},
468 { "_size_t","_wxWindowID",0},
469 { "_size_t","_uint",0},
470 { "_uint","_wxCoord",0},
471 { "_uint","_wxPrintQuality",0},
472 { "_uint","_time_t",0},
473 { "_uint","_size_t",0},
474 { "_uint","_unsigned_int",0},
475 { "_uint","_int",0},
476 { "_uint","_wxWindowID",0},
477 { "_wxChar","_char",0},
478 { "_char","_wxChar",0},
479 { "_EBool","_wxCoord",0},
480 { "_EBool","_wxPrintQuality",0},
481 { "_EBool","_signed_int",0},
482 { "_EBool","_int",0},
483 { "_EBool","_wxWindowID",0},
484 { "_unsigned_long","_long",0},
485 { "_signed_int","_wxCoord",0},
486 { "_signed_int","_wxPrintQuality",0},
487 { "_signed_int","_EBool",0},
488 { "_signed_int","_wxWindowID",0},
489 { "_signed_int","_int",0},
490 { "_WXTYPE","_short",0},
491 { "_WXTYPE","_signed_short",0},
492 { "_WXTYPE","_unsigned_short",0},
493 { "_unsigned_short","_WXTYPE",0},
494 { "_unsigned_short","_short",0},
495 { "_signed_short","_WXTYPE",0},
496 { "_signed_short","_short",0},
497 { "_unsigned_char","_byte",0},
498 { "_unsigned_int","_wxCoord",0},
499 { "_unsigned_int","_wxPrintQuality",0},
500 { "_unsigned_int","_time_t",0},
501 { "_unsigned_int","_size_t",0},
502 { "_unsigned_int","_uint",0},
503 { "_unsigned_int","_wxWindowID",0},
504 { "_unsigned_int","_int",0},
505 { "_short","_WXTYPE",0},
506 { "_short","_unsigned_short",0},
507 { "_short","_signed_short",0},
508 { "_wxWindowID","_wxCoord",0},
509 { "_wxWindowID","_wxPrintQuality",0},
510 { "_wxWindowID","_time_t",0},
511 { "_wxWindowID","_size_t",0},
512 { "_wxWindowID","_EBool",0},
513 { "_wxWindowID","_uint",0},
514 { "_wxWindowID","_int",0},
515 { "_wxWindowID","_signed_int",0},
516 { "_wxWindowID","_unsigned_int",0},
517 { "_int","_wxCoord",0},
518 { "_int","_wxPrintQuality",0},
519 { "_int","_time_t",0},
520 { "_int","_size_t",0},
521 { "_int","_EBool",0},
522 { "_int","_uint",0},
523 { "_int","_wxWindowID",0},
524 { "_int","_unsigned_int",0},
525 { "_int","_signed_int",0},
526 { "_time_t","_wxCoord",0},
527 { "_time_t","_wxPrintQuality",0},
528 { "_time_t","_unsigned_int",0},
529 { "_time_t","_int",0},
530 { "_time_t","_wxWindowID",0},
531 { "_time_t","_uint",0},
532 { "_time_t","_size_t",0},
533 { "_wxCoord","_int",0},
534 { "_wxCoord","_signed_int",0},
535 { "_wxCoord","_unsigned_int",0},
536 { "_wxCoord","_wxWindowID",0},
537 { "_wxCoord","_uint",0},
538 { "_wxCoord","_EBool",0},
539 { "_wxCoord","_size_t",0},
540 { "_wxCoord","_time_t",0},
541 { "_wxCoord","_wxPrintQuality",0},
542 {0,0,0}};
543
544 static PyObject *SWIG_globals;
545 #ifdef __cplusplus
546 extern "C"
547 #endif
548 SWIGEXPORT(void) initstreamsc() {
549 PyObject *m, *d;
550 SWIG_globals = SWIG_newvarlink();
551 m = Py_InitModule("streamsc", streamscMethods);
552 d = PyModule_GetDict(m);
553
554 wxPyPtrTypeMap_Add("wxInputStream", "wxPyInputStream");
555 {
556 int i;
557 for (i = 0; _swig_mapping[i].n1; i++)
558 SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
559 }
560 }