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 <wx/stream.h>
63 static PyObject
* t_output_helper(PyObject
* target
, PyObject
* o
) {
69 } else if (target
== Py_None
) {
73 if (!PyTuple_Check(target
)) {
75 target
= PyTuple_New(1);
76 PyTuple_SetItem(target
, 0, o2
);
79 PyTuple_SetItem(o3
, 0, o
);
82 target
= PySequence_Concat(o2
, o3
);
89 #if PYTHON_API_VERSION >= 1009
90 static char* wxStringErrorMsg
= "String or Unicode type required";
92 static char* wxStringErrorMsg
= "String type required";
97 static wxPyInputStream
*new_wxPyInputStream(PyObject
*p
) {
98 wxInputStream
* wxis
= wxPyCBInputStream::create(p
);
100 return new wxPyInputStream(wxis
);
105 static PyObject
*_wrap_new_wxInputStream(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
106 PyObject
* _resultobj
;
107 wxPyInputStream
* _result
;
109 PyObject
* _obj0
= 0;
110 char *_kwnames
[] = { "p", NULL
};
114 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O:new_wxInputStream",_kwnames
,&_obj0
))
120 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
121 _result
= (wxPyInputStream
*)new_wxPyInputStream(_arg0
);
123 wxPyEndAllowThreads(__tstate
);
124 if (PyErr_Occurred()) return NULL
;
126 SWIG_MakePtr(_ptemp
, (char *) _result
,"_wxPyInputStream_p");
127 _resultobj
= Py_BuildValue("s",_ptemp
);
130 _resultobj
= Py_None
;
135 #define wxInputStream_close(_swigobj) (_swigobj->close())
136 static PyObject
*_wrap_wxInputStream_close(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
137 PyObject
* _resultobj
;
138 wxPyInputStream
* _arg0
;
139 PyObject
* _argo0
= 0;
140 char *_kwnames
[] = { "self", NULL
};
143 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O:wxInputStream_close",_kwnames
,&_argo0
))
146 if (_argo0
== Py_None
) { _arg0
= NULL
; }
147 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
148 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_close. Expected _wxPyInputStream_p.");
153 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
154 wxInputStream_close(_arg0
);
156 wxPyEndAllowThreads(__tstate
);
157 if (PyErr_Occurred()) return NULL
;
158 } Py_INCREF(Py_None
);
159 _resultobj
= Py_None
;
163 #define wxInputStream_flush(_swigobj) (_swigobj->flush())
164 static PyObject
*_wrap_wxInputStream_flush(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
165 PyObject
* _resultobj
;
166 wxPyInputStream
* _arg0
;
167 PyObject
* _argo0
= 0;
168 char *_kwnames
[] = { "self", NULL
};
171 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O:wxInputStream_flush",_kwnames
,&_argo0
))
174 if (_argo0
== Py_None
) { _arg0
= NULL
; }
175 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
176 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_flush. Expected _wxPyInputStream_p.");
181 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
182 wxInputStream_flush(_arg0
);
184 wxPyEndAllowThreads(__tstate
);
185 if (PyErr_Occurred()) return NULL
;
186 } Py_INCREF(Py_None
);
187 _resultobj
= Py_None
;
191 #define wxInputStream_eof(_swigobj) (_swigobj->eof())
192 static PyObject
*_wrap_wxInputStream_eof(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
193 PyObject
* _resultobj
;
195 wxPyInputStream
* _arg0
;
196 PyObject
* _argo0
= 0;
197 char *_kwnames
[] = { "self", NULL
};
200 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O:wxInputStream_eof",_kwnames
,&_argo0
))
203 if (_argo0
== Py_None
) { _arg0
= NULL
; }
204 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
205 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_eof. Expected _wxPyInputStream_p.");
210 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
211 _result
= (bool )wxInputStream_eof(_arg0
);
213 wxPyEndAllowThreads(__tstate
);
214 if (PyErr_Occurred()) return NULL
;
215 } _resultobj
= Py_BuildValue("i",_result
);
219 #define wxInputStream_read(_swigobj,_swigarg0) (_swigobj->read(_swigarg0))
220 static PyObject
*_wrap_wxInputStream_read(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
221 PyObject
* _resultobj
;
223 wxPyInputStream
* _arg0
;
224 int _arg1
= (int ) -1;
225 PyObject
* _argo0
= 0;
226 char *_kwnames
[] = { "self","size", NULL
};
229 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O|i:wxInputStream_read",_kwnames
,&_argo0
,&_arg1
))
232 if (_argo0
== Py_None
) { _arg0
= NULL
; }
233 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
234 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_read. Expected _wxPyInputStream_p.");
239 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
240 _result
= (wxString
*)wxInputStream_read(_arg0
,_arg1
);
242 wxPyEndAllowThreads(__tstate
);
243 if (PyErr_Occurred()) return NULL
;
245 _resultobj
= PyString_FromStringAndSize(_result
->c_str(), _result
->Len());
250 #define wxInputStream_readline(_swigobj,_swigarg0) (_swigobj->readline(_swigarg0))
251 static PyObject
*_wrap_wxInputStream_readline(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
252 PyObject
* _resultobj
;
254 wxPyInputStream
* _arg0
;
255 int _arg1
= (int ) -1;
256 PyObject
* _argo0
= 0;
257 char *_kwnames
[] = { "self","size", NULL
};
260 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O|i:wxInputStream_readline",_kwnames
,&_argo0
,&_arg1
))
263 if (_argo0
== Py_None
) { _arg0
= NULL
; }
264 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
265 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_readline. Expected _wxPyInputStream_p.");
270 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
271 _result
= (wxString
*)wxInputStream_readline(_arg0
,_arg1
);
273 wxPyEndAllowThreads(__tstate
);
274 if (PyErr_Occurred()) return NULL
;
276 _resultobj
= PyString_FromStringAndSize(_result
->c_str(), _result
->Len());
281 #define wxInputStream_readlines(_swigobj,_swigarg0) (_swigobj->readlines(_swigarg0))
282 static PyObject
*_wrap_wxInputStream_readlines(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
283 PyObject
* _resultobj
;
284 wxStringPtrList
* _result
;
285 wxPyInputStream
* _arg0
;
286 int _arg1
= (int ) -1;
287 PyObject
* _argo0
= 0;
288 char *_kwnames
[] = { "self","sizehint", NULL
};
291 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O|i:wxInputStream_readlines",_kwnames
,&_argo0
,&_arg1
))
294 if (_argo0
== Py_None
) { _arg0
= NULL
; }
295 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
296 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_readlines. Expected _wxPyInputStream_p.");
301 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
302 _result
= (wxStringPtrList
*)wxInputStream_readlines(_arg0
,_arg1
);
304 wxPyEndAllowThreads(__tstate
);
305 if (PyErr_Occurred()) return NULL
;
308 _resultobj
= PyList_New(_result
->GetCount());
309 wxStringPtrList::Node
*node
= _result
->GetFirst();
310 for (int i
=0; node
; i
++) {
311 wxString
*s
= node
->GetData();
312 PyList_SetItem(_resultobj
, i
, PyString_FromStringAndSize(s
->c_str(), s
->Len()));
313 node
= node
->GetNext();
324 #define wxInputStream_seek(_swigobj,_swigarg0,_swigarg1) (_swigobj->seek(_swigarg0,_swigarg1))
325 static PyObject
*_wrap_wxInputStream_seek(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
326 PyObject
* _resultobj
;
327 wxPyInputStream
* _arg0
;
329 int _arg2
= (int ) 0;
330 PyObject
* _argo0
= 0;
331 char *_kwnames
[] = { "self","offset","whence", NULL
};
334 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"Oi|i:wxInputStream_seek",_kwnames
,&_argo0
,&_arg1
,&_arg2
))
337 if (_argo0
== Py_None
) { _arg0
= NULL
; }
338 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
339 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_seek. Expected _wxPyInputStream_p.");
344 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
345 wxInputStream_seek(_arg0
,_arg1
,_arg2
);
347 wxPyEndAllowThreads(__tstate
);
348 if (PyErr_Occurred()) return NULL
;
349 } Py_INCREF(Py_None
);
350 _resultobj
= Py_None
;
354 #define wxInputStream_tell(_swigobj) (_swigobj->tell())
355 static PyObject
*_wrap_wxInputStream_tell(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
356 PyObject
* _resultobj
;
358 wxPyInputStream
* _arg0
;
359 PyObject
* _argo0
= 0;
360 char *_kwnames
[] = { "self", NULL
};
363 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"O:wxInputStream_tell",_kwnames
,&_argo0
))
366 if (_argo0
== Py_None
) { _arg0
= NULL
; }
367 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxPyInputStream_p")) {
368 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxInputStream_tell. Expected _wxPyInputStream_p.");
373 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
374 _result
= (int )wxInputStream_tell(_arg0
);
376 wxPyEndAllowThreads(__tstate
);
377 if (PyErr_Occurred()) return NULL
;
378 } _resultobj
= Py_BuildValue("i",_result
);
382 static void wxOutputStream_write(wxOutputStream
*self
,const wxString
& str
) {
383 self
->Write(str
.c_str(), str
.Length());
385 static PyObject
*_wrap_wxOutputStream_write(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
) {
386 PyObject
* _resultobj
;
387 wxOutputStream
* _arg0
;
389 PyObject
* _argo0
= 0;
390 PyObject
* _obj1
= 0;
391 char *_kwnames
[] = { "self","str", NULL
};
394 if(!PyArg_ParseTupleAndKeywords(args
,kwargs
,"OO:wxOutputStream_write",_kwnames
,&_argo0
,&_obj1
))
397 if (_argo0
== Py_None
) { _arg0
= NULL
; }
398 else if (SWIG_GetPtrObj(_argo0
,(void **) &_arg0
,"_wxOutputStream_p")) {
399 PyErr_SetString(PyExc_TypeError
,"Type error in argument 1 of wxOutputStream_write. Expected _wxOutputStream_p.");
404 #if PYTHON_API_VERSION >= 1009
405 char* tmpPtr
; int tmpSize
;
406 if (!PyString_Check(_obj1
) && !PyUnicode_Check(_obj1
)) {
407 PyErr_SetString(PyExc_TypeError
, wxStringErrorMsg
);
410 if (PyString_AsStringAndSize(_obj1
, &tmpPtr
, &tmpSize
) == -1)
412 _arg1
= new wxString(tmpPtr
, tmpSize
);
414 if (!PyString_Check(_obj1
)) {
415 PyErr_SetString(PyExc_TypeError
, wxStringErrorMsg
);
418 _arg1
= new wxString(PyString_AS_STRING(_obj1
), PyString_GET_SIZE(_obj1
));
422 PyThreadState
* __tstate
= wxPyBeginAllowThreads();
423 wxOutputStream_write(_arg0
,*_arg1
);
425 wxPyEndAllowThreads(__tstate
);
426 if (PyErr_Occurred()) return NULL
;
427 } Py_INCREF(Py_None
);
428 _resultobj
= Py_None
;
436 static PyMethodDef streamscMethods
[] = {
437 { "wxOutputStream_write", (PyCFunction
) _wrap_wxOutputStream_write
, METH_VARARGS
| METH_KEYWORDS
},
438 { "wxInputStream_tell", (PyCFunction
) _wrap_wxInputStream_tell
, METH_VARARGS
| METH_KEYWORDS
},
439 { "wxInputStream_seek", (PyCFunction
) _wrap_wxInputStream_seek
, METH_VARARGS
| METH_KEYWORDS
},
440 { "wxInputStream_readlines", (PyCFunction
) _wrap_wxInputStream_readlines
, METH_VARARGS
| METH_KEYWORDS
},
441 { "wxInputStream_readline", (PyCFunction
) _wrap_wxInputStream_readline
, METH_VARARGS
| METH_KEYWORDS
},
442 { "wxInputStream_read", (PyCFunction
) _wrap_wxInputStream_read
, METH_VARARGS
| METH_KEYWORDS
},
443 { "wxInputStream_eof", (PyCFunction
) _wrap_wxInputStream_eof
, METH_VARARGS
| METH_KEYWORDS
},
444 { "wxInputStream_flush", (PyCFunction
) _wrap_wxInputStream_flush
, METH_VARARGS
| METH_KEYWORDS
},
445 { "wxInputStream_close", (PyCFunction
) _wrap_wxInputStream_close
, METH_VARARGS
| METH_KEYWORDS
},
446 { "new_wxInputStream", (PyCFunction
) _wrap_new_wxInputStream
, METH_VARARGS
| METH_KEYWORDS
},
453 * This table is used by the pointer type-checker
455 static struct { char *n1
; char *n2
; void *(*pcnv
)(void *); } _swig_mapping
[] = {
456 { "_signed_long","_long",0},
457 { "_wxPrintQuality","_wxCoord",0},
458 { "_wxPrintQuality","_int",0},
459 { "_wxPrintQuality","_signed_int",0},
460 { "_wxPrintQuality","_unsigned_int",0},
461 { "_wxPrintQuality","_wxWindowID",0},
462 { "_wxPrintQuality","_uint",0},
463 { "_wxPrintQuality","_EBool",0},
464 { "_wxPrintQuality","_size_t",0},
465 { "_wxPrintQuality","_time_t",0},
466 { "_byte","_unsigned_char",0},
467 { "_long","_unsigned_long",0},
468 { "_long","_signed_long",0},
469 { "_size_t","_wxCoord",0},
470 { "_size_t","_wxPrintQuality",0},
471 { "_size_t","_time_t",0},
472 { "_size_t","_unsigned_int",0},
473 { "_size_t","_int",0},
474 { "_size_t","_wxWindowID",0},
475 { "_size_t","_uint",0},
476 { "_uint","_wxCoord",0},
477 { "_uint","_wxPrintQuality",0},
478 { "_uint","_time_t",0},
479 { "_uint","_size_t",0},
480 { "_uint","_unsigned_int",0},
482 { "_uint","_wxWindowID",0},
483 { "_wxChar","_char",0},
484 { "_char","_wxChar",0},
485 { "_EBool","_wxCoord",0},
486 { "_EBool","_wxPrintQuality",0},
487 { "_EBool","_signed_int",0},
488 { "_EBool","_int",0},
489 { "_EBool","_wxWindowID",0},
490 { "_unsigned_long","_long",0},
491 { "_signed_int","_wxCoord",0},
492 { "_signed_int","_wxPrintQuality",0},
493 { "_signed_int","_EBool",0},
494 { "_signed_int","_wxWindowID",0},
495 { "_signed_int","_int",0},
496 { "_WXTYPE","_short",0},
497 { "_WXTYPE","_signed_short",0},
498 { "_WXTYPE","_unsigned_short",0},
499 { "_unsigned_short","_WXTYPE",0},
500 { "_unsigned_short","_short",0},
501 { "_signed_short","_WXTYPE",0},
502 { "_signed_short","_short",0},
503 { "_unsigned_char","_byte",0},
504 { "_unsigned_int","_wxCoord",0},
505 { "_unsigned_int","_wxPrintQuality",0},
506 { "_unsigned_int","_time_t",0},
507 { "_unsigned_int","_size_t",0},
508 { "_unsigned_int","_uint",0},
509 { "_unsigned_int","_wxWindowID",0},
510 { "_unsigned_int","_int",0},
511 { "_short","_WXTYPE",0},
512 { "_short","_unsigned_short",0},
513 { "_short","_signed_short",0},
514 { "_wxWindowID","_wxCoord",0},
515 { "_wxWindowID","_wxPrintQuality",0},
516 { "_wxWindowID","_time_t",0},
517 { "_wxWindowID","_size_t",0},
518 { "_wxWindowID","_EBool",0},
519 { "_wxWindowID","_uint",0},
520 { "_wxWindowID","_int",0},
521 { "_wxWindowID","_signed_int",0},
522 { "_wxWindowID","_unsigned_int",0},
523 { "_int","_wxCoord",0},
524 { "_int","_wxPrintQuality",0},
525 { "_int","_time_t",0},
526 { "_int","_size_t",0},
527 { "_int","_EBool",0},
529 { "_int","_wxWindowID",0},
530 { "_int","_unsigned_int",0},
531 { "_int","_signed_int",0},
532 { "_time_t","_wxCoord",0},
533 { "_time_t","_wxPrintQuality",0},
534 { "_time_t","_unsigned_int",0},
535 { "_time_t","_int",0},
536 { "_time_t","_wxWindowID",0},
537 { "_time_t","_uint",0},
538 { "_time_t","_size_t",0},
539 { "_wxCoord","_int",0},
540 { "_wxCoord","_signed_int",0},
541 { "_wxCoord","_unsigned_int",0},
542 { "_wxCoord","_wxWindowID",0},
543 { "_wxCoord","_uint",0},
544 { "_wxCoord","_EBool",0},
545 { "_wxCoord","_size_t",0},
546 { "_wxCoord","_time_t",0},
547 { "_wxCoord","_wxPrintQuality",0},
550 static PyObject
*SWIG_globals
;
554 SWIGEXPORT(void) initstreamsc() {
556 SWIG_globals
= SWIG_newvarlink();
557 m
= Py_InitModule("streamsc", streamscMethods
);
558 d
= PyModule_GetDict(m
);
560 wxPyPtrTypeMap_Add("wxInputStream", "wxPyInputStream");
563 for (i
= 0; _swig_mapping
[i
].n1
; i
++)
564 SWIG_RegisterMapping(_swig_mapping
[i
].n1
,_swig_mapping
[i
].n2
,_swig_mapping
[i
].pcnv
);