2 * FILE : src/msw/streams.cpp
4 * This file was automatically generated by :
5 * Simplified Wrapper and Interface Generator (SWIG)
6 * Version 1.1 (Build 883)
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.
13 * Do not make changes to this file--changes will be lost!
19 /* Implementation : PYTHON */
24 /* Definitions for Windows/Unix exporting */
25 #if defined(__WIN32__)
26 # if defined(_MSC_VER)
27 # define SWIGEXPORT(a) __declspec(dllexport) a
29 # if defined(__BORLANDC__)
30 # define SWIGEXPORT(a) a _export
32 # define SWIGEXPORT(a) a
36 # define SWIGEXPORT(a) a
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);
54 #define SWIG_init initstreamsc
56 #define SWIG_name "streamsc"
59 #include "pyistream.h"
60 #include <wx/stream.h>
64 static PyObject
* t_output_helper(PyObject
* target
, PyObject
* o
) {
70 } else if (target
== Py_None
) {
74 if (!PyTuple_Check(target
)) {
76 target
= PyTuple_New(1);
77 PyTuple_SetItem(target
, 0, o2
);
80 PyTuple_SetItem(o3
, 0, o
);
83 target
= PySequence_Concat(o2
, o3
);
90 #if PYTHON_API_VERSION >= 1009
91 static char* wxStringErrorMsg
= "String or Unicode type required";
93 static char* wxStringErrorMsg
= "String type required";
98 static wxPyInputStream
*new_wxPyInputStream(PyObject
*p
) {
99 wxInputStream
* wxis
= wxPyCBInputStream::create(p
);
101 return new wxPyInputStream(wxis
);
106 static PyObject
*_wrap_new_wxInputStream(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
107 PyObject
* _resultobj
;
108 wxPyInputStream
* _result
;
110 PyObject
* _obj0
= 0;
111 char *_kwnames
[] = { "p", NULL
};
115 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O:new_wxInputStream",_kwnames
,&_obj0
))
121 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
122 _result
= (wxPyInputStream
*)new_wxPyInputStream(_arg0
);
124 wxPyEndAllowThreads(__tstate
);
125 if (PyErr_Occurred()) return NULL
;
127 SWIG_MakePtr(_ptemp
, (char *) _result
,"_wxPyInputStream_p");
128 _resultobj
= Py_BuildValue("s",_ptemp
);
131 _resultobj
= Py_None
;
136 #define wxInputStream_close(_swigobj) (_swigobj->close())
137 static PyObject
*_wrap_wxInputStream_close(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
138 PyObject
* _resultobj
;
139 wxPyInputStream
* _arg0
;
140 PyObject
* _argo0
= 0;
141 char *_kwnames
[] = { "self", NULL
};
144 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O:wxInputStream_close",_kwnames
,&_argo0
))
147 if (_argo0
== Py_None
) { _arg0
= NULL
; }
148 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
149 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_close. Expected _wxPyInputStream_p.");
154 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
155 wxInputStream_close(_arg0
);
157 wxPyEndAllowThreads(__tstate
);
158 if (PyErr_Occurred()) return NULL
;
159 } Py_INCREF(Py_None
);
160 _resultobj
= Py_None
;
164 #define wxInputStream_flush(_swigobj) (_swigobj->flush())
165 static PyObject
*_wrap_wxInputStream_flush(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
166 PyObject
* _resultobj
;
167 wxPyInputStream
* _arg0
;
168 PyObject
* _argo0
= 0;
169 char *_kwnames
[] = { "self", NULL
};
172 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O:wxInputStream_flush",_kwnames
,&_argo0
))
175 if (_argo0
== Py_None
) { _arg0
= NULL
; }
176 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
177 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_flush. Expected _wxPyInputStream_p.");
182 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
183 wxInputStream_flush(_arg0
);
185 wxPyEndAllowThreads(__tstate
);
186 if (PyErr_Occurred()) return NULL
;
187 } Py_INCREF(Py_None
);
188 _resultobj
= Py_None
;
192 #define wxInputStream_eof(_swigobj) (_swigobj->eof())
193 static PyObject
*_wrap_wxInputStream_eof(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
194 PyObject
* _resultobj
;
196 wxPyInputStream
* _arg0
;
197 PyObject
* _argo0
= 0;
198 char *_kwnames
[] = { "self", NULL
};
201 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O:wxInputStream_eof",_kwnames
,&_argo0
))
204 if (_argo0
== Py_None
) { _arg0
= NULL
; }
205 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
206 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_eof. Expected _wxPyInputStream_p.");
211 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
212 _result
= (bool )wxInputStream_eof(_arg0
);
214 wxPyEndAllowThreads(__tstate
);
215 if (PyErr_Occurred()) return NULL
;
216 } _resultobj
= Py_BuildValue("i",_result
);
220 #define wxInputStream_read(_swigobj,_swigarg0) (_swigobj->read(_swigarg0))
221 static PyObject
*_wrap_wxInputStream_read(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
222 PyObject
* _resultobj
;
224 wxPyInputStream
* _arg0
;
225 int _arg1
= (int ) -1;
226 PyObject
* _argo0
= 0;
227 char *_kwnames
[] = { "self","size", NULL
};
230 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O|i:wxInputStream_read",_kwnames
,&_argo0
,&_arg1
))
233 if (_argo0
== Py_None
) { _arg0
= NULL
; }
234 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
235 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_read. Expected _wxPyInputStream_p.");
240 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
241 _result
= (wxString
*)wxInputStream_read(_arg0
,_arg1
);
243 wxPyEndAllowThreads(__tstate
);
244 if (PyErr_Occurred()) return NULL
;
246 _resultobj
= PyString_FromStringAndSize(_result
->c_str(), _result
->Len());
251 #define wxInputStream_readline(_swigobj,_swigarg0) (_swigobj->readline(_swigarg0))
252 static PyObject
*_wrap_wxInputStream_readline(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
253 PyObject
* _resultobj
;
255 wxPyInputStream
* _arg0
;
256 int _arg1
= (int ) -1;
257 PyObject
* _argo0
= 0;
258 char *_kwnames
[] = { "self","size", NULL
};
261 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O|i:wxInputStream_readline",_kwnames
,&_argo0
,&_arg1
))
264 if (_argo0
== Py_None
) { _arg0
= NULL
; }
265 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
266 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_readline. Expected _wxPyInputStream_p.");
271 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
272 _result
= (wxString
*)wxInputStream_readline(_arg0
,_arg1
);
274 wxPyEndAllowThreads(__tstate
);
275 if (PyErr_Occurred()) return NULL
;
277 _resultobj
= PyString_FromStringAndSize(_result
->c_str(), _result
->Len());
282 #define wxInputStream_readlines(_swigobj,_swigarg0) (_swigobj->readlines(_swigarg0))
283 static PyObject
*_wrap_wxInputStream_readlines(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
284 PyObject
* _resultobj
;
285 wxStringPtrList
* _result
;
286 wxPyInputStream
* _arg0
;
287 int _arg1
= (int ) -1;
288 PyObject
* _argo0
= 0;
289 char *_kwnames
[] = { "self","sizehint", NULL
};
292 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O|i:wxInputStream_readlines",_kwnames
,&_argo0
,&_arg1
))
295 if (_argo0
== Py_None
) { _arg0
= NULL
; }
296 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
297 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_readlines. Expected _wxPyInputStream_p.");
302 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
303 _result
= (wxStringPtrList
*)wxInputStream_readlines(_arg0
,_arg1
);
305 wxPyEndAllowThreads(__tstate
);
306 if (PyErr_Occurred()) return NULL
;
309 _resultobj
= PyList_New(_result
->GetCount());
310 wxStringPtrList::Node
*node
= _result
->GetFirst();
311 for (int i
=0; node
; i
++) {
312 wxString
*s
= node
->GetData();
313 PyList_SetItem(_resultobj
, i
, PyString_FromStringAndSize(s
->c_str(), s
->Len()));
314 node
= node
->GetNext();
325 #define wxInputStream_seek(_swigobj,_swigarg0,_swigarg1) (_swigobj->seek(_swigarg0,_swigarg1))
326 static PyObject
*_wrap_wxInputStream_seek(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
327 PyObject
* _resultobj
;
328 wxPyInputStream
* _arg0
;
330 int _arg2
= (int ) 0;
331 PyObject
* _argo0
= 0;
332 char *_kwnames
[] = { "self","offset","whence", NULL
};
335 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"Oi|i:wxInputStream_seek",_kwnames
,&_argo0
,&_arg1
,&_arg2
))
338 if (_argo0
== Py_None
) { _arg0
= NULL
; }
339 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
340 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_seek. Expected _wxPyInputStream_p.");
345 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
346 wxInputStream_seek(_arg0
,_arg1
,_arg2
);
348 wxPyEndAllowThreads(__tstate
);
349 if (PyErr_Occurred()) return NULL
;
350 } Py_INCREF(Py_None
);
351 _resultobj
= Py_None
;
355 #define wxInputStream_tell(_swigobj) (_swigobj->tell())
356 static PyObject
*_wrap_wxInputStream_tell(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
357 PyObject
* _resultobj
;
359 wxPyInputStream
* _arg0
;
360 PyObject
* _argo0
= 0;
361 char *_kwnames
[] = { "self", NULL
};
364 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O:wxInputStream_tell",_kwnames
,&_argo0
))
367 if (_argo0
== Py_None
) { _arg0
= NULL
; }
368 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
369 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_tell. Expected _wxPyInputStream_p.");
374 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
375 _result
= (int )wxInputStream_tell(_arg0
);
377 wxPyEndAllowThreads(__tstate
);
378 if (PyErr_Occurred()) return NULL
;
379 } _resultobj
= Py_BuildValue("i",_result
);
383 static void wxOutputStream_write(wxOutputStream
*self
,const wxString
& str
) {
384 self
->Write(str
.c_str(), str
.Length());
386 static PyObject
*_wrap_wxOutputStream_write(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
387 PyObject
* _resultobj
;
388 wxOutputStream
* _arg0
;
390 PyObject
* _argo0
= 0;
391 PyObject
* _obj1
= 0;
392 char *_kwnames
[] = { "self","str", NULL
};
395 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"OO:wxOutputStream_write",_kwnames
,&_argo0
,&_obj1
))
398 if (_argo0
== Py_None
) { _arg0
= NULL
; }
399 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxOutputStream_p")) {
400 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxOutputStream_write. Expected _wxOutputStream_p.");
405 #if PYTHON_API_VERSION >= 1009
406 char* tmpPtr
; int tmpSize
;
407 if (!PyString_Check(_obj1
) && !PyUnicode_Check(_obj1
)) {
408 PyErr_SetString(PyExc_TypeError
, wxStringErrorMsg
);
411 if (PyString_AsStringAndSize(_obj1
, &tmpPtr
, &tmpSize
) == -1)
413 _arg1
= new wxString(tmpPtr
, tmpSize
);
415 if (!PyString_Check(_obj1
)) {
416 PyErr_SetString(PyExc_TypeError
, wxStringErrorMsg
);
419 _arg1
= new wxString(PyString_AS_STRING(_obj1
), PyString_GET_SIZE(_obj1
));
423 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
424 wxOutputStream_write(_arg0
,*_arg1
);
426 wxPyEndAllowThreads(__tstate
);
427 if (PyErr_Occurred()) return NULL
;
428 } Py_INCREF(Py_None
);
429 _resultobj
= Py_None
;
437 static PyMethodDef streamscMethods
[] = {
438 { "wxOutputStream_write", (PyCFunction
) _wrap_wxOutputStream_write
, METH_VARARGS
| METH_KEYWORDS
},
439 { "wxInputStream_tell", (PyCFunction
) _wrap_wxInputStream_tell
, METH_VARARGS
| METH_KEYWORDS
},
440 { "wxInputStream_seek", (PyCFunction
) _wrap_wxInputStream_seek
, METH_VARARGS
| METH_KEYWORDS
},
441 { "wxInputStream_readlines", (PyCFunction
) _wrap_wxInputStream_readlines
, METH_VARARGS
| METH_KEYWORDS
},
442 { "wxInputStream_readline", (PyCFunction
) _wrap_wxInputStream_readline
, METH_VARARGS
| METH_KEYWORDS
},
443 { "wxInputStream_read", (PyCFunction
) _wrap_wxInputStream_read
, METH_VARARGS
| METH_KEYWORDS
},
444 { "wxInputStream_eof", (PyCFunction
) _wrap_wxInputStream_eof
, METH_VARARGS
| METH_KEYWORDS
},
445 { "wxInputStream_flush", (PyCFunction
) _wrap_wxInputStream_flush
, METH_VARARGS
| METH_KEYWORDS
},
446 { "wxInputStream_close", (PyCFunction
) _wrap_wxInputStream_close
, METH_VARARGS
| METH_KEYWORDS
},
447 { "new_wxInputStream", (PyCFunction
) _wrap_new_wxInputStream
, METH_VARARGS
| METH_KEYWORDS
},
454 * This table is used by the pointer type-checker
456 static struct { char *n1
; char *n2
; void *(*pcnv
)(void *); } _swig_mapping
[] = {
457 { "_signed_long","_long",0},
458 { "_wxPrintQuality","_wxCoord",0},
459 { "_wxPrintQuality","_int",0},
460 { "_wxPrintQuality","_signed_int",0},
461 { "_wxPrintQuality","_unsigned_int",0},
462 { "_wxPrintQuality","_wxWindowID",0},
463 { "_wxPrintQuality","_uint",0},
464 { "_wxPrintQuality","_EBool",0},
465 { "_wxPrintQuality","_size_t",0},
466 { "_wxPrintQuality","_time_t",0},
467 { "_byte","_unsigned_char",0},
468 { "_long","_unsigned_long",0},
469 { "_long","_signed_long",0},
470 { "_size_t","_wxCoord",0},
471 { "_size_t","_wxPrintQuality",0},
472 { "_size_t","_time_t",0},
473 { "_size_t","_unsigned_int",0},
474 { "_size_t","_int",0},
475 { "_size_t","_wxWindowID",0},
476 { "_size_t","_uint",0},
477 { "_uint","_wxCoord",0},
478 { "_uint","_wxPrintQuality",0},
479 { "_uint","_time_t",0},
480 { "_uint","_size_t",0},
481 { "_uint","_unsigned_int",0},
483 { "_uint","_wxWindowID",0},
484 { "_wxChar","_char",0},
485 { "_char","_wxChar",0},
486 { "_EBool","_wxCoord",0},
487 { "_EBool","_wxPrintQuality",0},
488 { "_EBool","_signed_int",0},
489 { "_EBool","_int",0},
490 { "_EBool","_wxWindowID",0},
491 { "_unsigned_long","_long",0},
492 { "_signed_int","_wxCoord",0},
493 { "_signed_int","_wxPrintQuality",0},
494 { "_signed_int","_EBool",0},
495 { "_signed_int","_wxWindowID",0},
496 { "_signed_int","_int",0},
497 { "_WXTYPE","_short",0},
498 { "_WXTYPE","_signed_short",0},
499 { "_WXTYPE","_unsigned_short",0},
500 { "_unsigned_short","_WXTYPE",0},
501 { "_unsigned_short","_short",0},
502 { "_signed_short","_WXTYPE",0},
503 { "_signed_short","_short",0},
504 { "_unsigned_char","_byte",0},
505 { "_unsigned_int","_wxCoord",0},
506 { "_unsigned_int","_wxPrintQuality",0},
507 { "_unsigned_int","_time_t",0},
508 { "_unsigned_int","_size_t",0},
509 { "_unsigned_int","_uint",0},
510 { "_unsigned_int","_wxWindowID",0},
511 { "_unsigned_int","_int",0},
512 { "_short","_WXTYPE",0},
513 { "_short","_unsigned_short",0},
514 { "_short","_signed_short",0},
515 { "_wxWindowID","_wxCoord",0},
516 { "_wxWindowID","_wxPrintQuality",0},
517 { "_wxWindowID","_time_t",0},
518 { "_wxWindowID","_size_t",0},
519 { "_wxWindowID","_EBool",0},
520 { "_wxWindowID","_uint",0},
521 { "_wxWindowID","_int",0},
522 { "_wxWindowID","_signed_int",0},
523 { "_wxWindowID","_unsigned_int",0},
524 { "_int","_wxCoord",0},
525 { "_int","_wxPrintQuality",0},
526 { "_int","_time_t",0},
527 { "_int","_size_t",0},
528 { "_int","_EBool",0},
530 { "_int","_wxWindowID",0},
531 { "_int","_unsigned_int",0},
532 { "_int","_signed_int",0},
533 { "_time_t","_wxCoord",0},
534 { "_time_t","_wxPrintQuality",0},
535 { "_time_t","_unsigned_int",0},
536 { "_time_t","_int",0},
537 { "_time_t","_wxWindowID",0},
538 { "_time_t","_uint",0},
539 { "_time_t","_size_t",0},
540 { "_wxCoord","_int",0},
541 { "_wxCoord","_signed_int",0},
542 { "_wxCoord","_unsigned_int",0},
543 { "_wxCoord","_wxWindowID",0},
544 { "_wxCoord","_uint",0},
545 { "_wxCoord","_EBool",0},
546 { "_wxCoord","_size_t",0},
547 { "_wxCoord","_time_t",0},
548 { "_wxCoord","_wxPrintQuality",0},
551 static PyObject
*SWIG_globals
;
555 SWIGEXPORT(void) initstreamsc() {
557 SWIG_globals
= SWIG_newvarlink();
558 m
= Py_InitModule("streamsc", streamscMethods
);
559 d
= PyModule_GetDict(m
);
561 wxPyPtrTypeMap_Add("wxInputStream", "wxPyInputStream");
564 for (i
= 0; _swig_mapping
[i
].n1
; i
++)
565 SWIG_RegisterMapping(_swig_mapping
[i
].n1
,_swig_mapping
[i
].n2
,_swig_mapping
[i
].pcnv
);