]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/gtk/streams.cpp
Changes needed to get upto date with the latest wx CVS
[wxWidgets.git] / wxPython / src / gtk / streams.cpp
index 0be2ad0fa48029ded5ed3e1153241711dc546825..388cc1e300d6851dcea31e1f44c5a836f21e23d0 100644 (file)
@@ -3,7 +3,7 @@
  * 
  * This file was automatically generated by :
  * Simplified Wrapper and Interface Generator (SWIG)
- * Version 1.1 (Build 810)
+ * Version 1.1 (Build 883)
  * 
  * Portions Copyright (c) 1995-1998
  * The University of Utah and The Regents of the University of California.
@@ -19,6 +19,8 @@
 /* Implementation : PYTHON */
 
 #define SWIGPYTHON
+#include "Python.h"
+
 #include <string.h>
 #include <stdlib.h>
 /* Definitions for Windows/Unix exporting */
@@ -36,8 +38,6 @@
 #   define SWIGEXPORT(a) a
 #endif
 
-#include "Python.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -55,28 +55,10 @@ extern PyObject *SWIG_newvarlink(void);
 #define SWIG_name    "streamsc"
 
 #include "helpers.h"
+#include "pyistream.h"
 #include <wx/stream.h>
 #include <wx/list.h>
 
-static PyObject* l_output_helper(PyObject* target, PyObject* o) {
-    PyObject*   o2;
-    if (!target) {
-        target = o;
-    } else if (target == Py_None) {
-        Py_DECREF(Py_None);
-        target = o;
-    } else {
-        if (!PyList_Check(target)) {
-            o2 = target;
-            target = PyList_New(0);
-            PyList_Append(target, o2);
-           Py_XDECREF(o2);
-        }
-        PyList_Append(target,o);
-       Py_XDECREF(o);
-    }
-    return target;
-}
 
 static PyObject* t_output_helper(PyObject* target, PyObject* o) {
     PyObject*   o2;
@@ -103,318 +85,13 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
     }
     return target;
 }
-
-static char* wxStringErrorMsg = "string type is required for parameter";
-  // C++
-// definitions of wxStringPtrList and wxPyInputStream
-#include <wx/listimpl.cpp>
-WX_DEFINE_LIST(wxStringPtrList);
-
-
-void wxPyInputStream::close() {
-    /* do nothing */
-}
-
-void wxPyInputStream::flush() {
-    /*do nothing*/
-}
-
-bool wxPyInputStream::eof() {
-    if (wxi)
-        return wxi->Eof();
-    else
-        return TRUE;
-}
-
-wxPyInputStream::~wxPyInputStream() {
-    /*do nothing*/
-}
-
-wxString* wxPyInputStream::read(int size) {
-    wxString* s = NULL;
-    const int BUFSIZE = 1024;
-
-    // check if we have a real wxInputStream to work with
-    if (!wxi) {
-        PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
-        return NULL;
-    }
-
-    if (size < 0) {
-        // init buffers
-        char * buf = new char[BUFSIZE];
-        if (!buf) {
-            PyErr_NoMemory();
-            return NULL;
-        }
-
-        s = new wxString();
-        if (!s) {
-            delete buf;
-            PyErr_NoMemory();
-            return NULL;
-        }
-
-        // read until EOF
-        wxPy_BEGIN_ALLOW_THREADS;
-        while (! wxi->Eof()) {
-            wxi->Read(buf, BUFSIZE);
-            //*s += wxString(buf, wxi->LastRead());
-            s->Append(buf, wxi->LastRead());
-        }
-        delete buf;
-        wxPy_END_ALLOW_THREADS;
-
-        // error check
-        if (wxi->LastError() == wxSTREAM_READ_ERROR) {
-            delete s;
-            PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
-            return NULL;
-        }
-
-    } else {  // Read only size number of characters
-        s = new wxString;
-        if (!s) {
-            PyErr_NoMemory();
-            return NULL;
-        }
-
-        // read size bytes
-        wxPy_BEGIN_ALLOW_THREADS;
-        wxi->Read(s->GetWriteBuf(size+1), size);
-        s->UngetWriteBuf(wxi->LastRead());
-        wxPy_END_ALLOW_THREADS;
-
-        // error check
-        if (wxi->LastError() == wxSTREAM_READ_ERROR) {
-            delete s;
-            PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
-            return NULL;
-        }
-    }
-    return s;
-}
-
-
-wxString* wxPyInputStream::readline (int size) {
-    // check if we have a real wxInputStream to work with
-    if (!wxi) {
-        PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
-        return NULL;
-    }
-
-    // init buffer
-    int i;
-    char ch;
-    wxString* s = new wxString;
-    if (!s) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-
-    // read until \n or byte limit reached
-    wxPy_BEGIN_ALLOW_THREADS;
-    for (i=ch=0; (ch != '\n') && (!wxi->Eof()) && ((size < 0) || (i < size)); i++) {
-        *s += ch = wxi->GetC();
-    }
-    wxPy_END_ALLOW_THREADS;
-
-    // errorcheck
-    if (wxi->LastError() == wxSTREAM_READ_ERROR) {
-        delete s;
-        PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
-        return NULL;
-    }
-    return s;
-}
-
-
-wxStringPtrList* wxPyInputStream::readlines (int sizehint) {
-    // check if we have a real wxInputStream to work with
-    if (!wxi) {
-        PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
-        return NULL;
-    }
-
-    // init list
-    wxStringPtrList* l = new wxStringPtrList();
-    if (!l) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-
-    // read sizehint bytes or until EOF
-    wxPy_BEGIN_ALLOW_THREADS;
-    int i;
-    for (i=0; (!wxi->Eof()) && ((sizehint < 0) || (i < sizehint));) {
-        wxString* s = readline();
-        if (s == NULL) {
-            l->DeleteContents(TRUE);
-            l->Clear();
-            return NULL;
-        }
-        l->Append(s);
-        i = i + s->Length();
-    }
-    wxPy_END_ALLOW_THREADS;
-
-    // error check
-    if (wxi->LastError() == wxSTREAM_READ_ERROR) {
-        l->DeleteContents(TRUE);
-        l->Clear();
-        PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
-        return NULL;
-    }
-    return l;
-}
-
-
-void wxPyInputStream::seek(int offset, int whence) {
-    if (wxi)
-        wxi->SeekI(offset, wxSeekMode(whence));
-}
-
-int wxPyInputStream::tell(){
-    if (wxi)
-        return wxi->TellI();
-}
-
-
-
-// wxInputStream which operates on a Python file-like object
-class wxPyCBInputStream : public wxInputStream {
-protected:
-    PyObject* read;
-    PyObject* seek;
-    PyObject* tell;
-    PyObject* py;
-
-    virtual size_t OnSysRead(void *buffer, size_t bufsize) {
-        if (bufsize == 0)
-            return 0;
-
-        bool doSave = wxPyRestoreThread();
-        PyObject* arglist = Py_BuildValue("(i)", bufsize);
-        PyObject* result = PyEval_CallObject(read, arglist);
-        Py_DECREF(arglist);
-
-        size_t o = 0;
-        if ((result != NULL) && PyString_Check(result)) {
-            o = PyString_Size(result);
-            if (o == 0)
-                m_lasterror = wxSTREAM_EOF;
-            if (o > bufsize)
-                o = bufsize;
-            strncpy((char*)buffer, PyString_AsString(result), o);
-            Py_DECREF(result);
-
-        }
-        else
-            m_lasterror = wxSTREAM_READ_ERROR;
-        wxPySaveThread(doSave);
-        m_lastcount = o;
-        return o;
-    }
-
-    virtual size_t OnSysWrite(const void *buffer, size_t bufsize){
-        m_lasterror = wxSTREAM_WRITE_ERROR;
-        return 0;
-    }
-
-    virtual off_t OnSysSeek(off_t off, wxSeekMode mode){
-        bool doSave = wxPyRestoreThread();
-        PyObject*arglist = Py_BuildValue("(ii)", off, mode);
-        PyObject*result = PyEval_CallObject(seek, arglist);
-        Py_DECREF(arglist);
-        Py_XDECREF(result);
-        wxPySaveThread(doSave);
-        return OnSysTell();
-    }
-
-    virtual off_t OnSysTell() const{
-        bool doSave = wxPyRestoreThread();
-        PyObject* arglist = Py_BuildValue("()");
-        PyObject* result = PyEval_CallObject(tell, arglist);
-        Py_DECREF(arglist);
-        off_t o = 0;
-        if (result != NULL) {
-            o = PyInt_AsLong(result);
-            Py_DECREF(result);
-        };
-        wxPySaveThread(doSave);
-        return o;
-    }
-
-    wxPyCBInputStream(PyObject *p, PyObject *r, PyObject *s, PyObject *t)
-        : py(p), read(r), seek(s), tell(t)
-        {}
-
-public:
-    ~wxPyCBInputStream() {
-        bool doSave = wxPyRestoreThread();
-        Py_XDECREF(py);
-        Py_XDECREF(read);
-        Py_XDECREF(seek);
-        Py_XDECREF(tell);
-        wxPySaveThread(doSave);
-    }
-
-    virtual size_t GetSize() {
-        if (seek && tell) {
-            off_t temp = OnSysTell();
-            off_t ret = OnSysSeek(0, wxFromEnd);
-            OnSysSeek(temp, wxFromStart);
-            return ret;
-        }
-        else
-            return 0;
-    }
-
-    static wxPyCBInputStream* create(PyObject *py) {
-        PyObject* read;
-        PyObject* seek;
-        PyObject* tell;
-
-        if (!PyInstance_Check(py) && !PyFile_Check(py)) {
-            PyErr_SetString(PyExc_TypeError, "Not a file-like object");
-            Py_XDECREF(py);
-            return NULL;
-        }
-        read = getMethod(py, "read");
-        seek = getMethod(py, "seek");
-        tell = getMethod(py, "tell");
-
-        if (!read) {
-            PyErr_SetString(PyExc_TypeError, "Not a file-like object");
-            Py_XDECREF(py);
-            Py_XDECREF(read);
-            Py_XDECREF(seek);
-            Py_XDECREF(tell);
-            return NULL;
-        }
-        return new wxPyCBInputStream(py, read, seek, tell);
-    }
-
-    static PyObject* getMethod(PyObject* py, char* name) {
-        if (!PyObject_HasAttrString(py, name))
-            return NULL;
-        PyObject* o = PyObject_GetAttrString(py, name);
-        if (!PyMethod_Check(o) && !PyCFunction_Check(o))
-            return NULL;
-        return o;
-    }
-
-protected:
-
-};
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 static wxPyInputStream *new_wxPyInputStream(PyObject *p) {
-            wxInputStream* wxi = wxPyCBInputStream::create(p);
-            if (wxi)
-                return new wxPyInputStream(wxi);
+            wxInputStream* wxis = wxPyCBInputStream::create(p);
+            if (wxis)
+                return new wxPyInputStream(wxis);
             else
                 return NULL;
         }
@@ -425,6 +102,7 @@ static PyObject *_wrap_new_wxInputStream(PyObject *self, PyObject *args, PyObjec
     PyObject * _arg0;
     PyObject * _obj0 = 0;
     char *_kwnames[] = { "p", NULL };
+    char _ptemp[128];
 
     self = self;
     if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:new_wxInputStream",_kwnames,&_obj0)) 
@@ -433,17 +111,18 @@ static PyObject *_wrap_new_wxInputStream(PyObject *self, PyObject *args, PyObjec
   _arg0 = _obj0;
 }
 {
-        _result = (wxPyInputStream *)new_wxPyInputStream(_arg0);
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (wxPyInputStream *)new_wxPyInputStream(_arg0);
 
-}{
-    char _ptemp[128];
-    if (_result) {
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    if (_result) {
         SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyInputStream_p");
         _resultobj = Py_BuildValue("s",_ptemp);
+    } else {
+        Py_INCREF(Py_None);
+        _resultobj = Py_None;
     }
-    else
-        _resultobj=0;
-}
     return _resultobj;
 }
 
@@ -465,8 +144,11 @@ static PyObject *_wrap_wxInputStream_close(PyObject *self, PyObject *args, PyObj
         }
     }
 {
-        wxInputStream_close(_arg0);
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxInputStream_close(_arg0);
 
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
 }    Py_INCREF(Py_None);
     _resultobj = Py_None;
     return _resultobj;
@@ -490,8 +172,11 @@ static PyObject *_wrap_wxInputStream_flush(PyObject *self, PyObject *args, PyObj
         }
     }
 {
-        wxInputStream_flush(_arg0);
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxInputStream_flush(_arg0);
 
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
 }    Py_INCREF(Py_None);
     _resultobj = Py_None;
     return _resultobj;
@@ -516,8 +201,11 @@ static PyObject *_wrap_wxInputStream_eof(PyObject *self, PyObject *args, PyObjec
         }
     }
 {
-        _result = (bool )wxInputStream_eof(_arg0);
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (bool )wxInputStream_eof(_arg0);
 
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
 }    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
@@ -525,7 +213,7 @@ static PyObject *_wrap_wxInputStream_eof(PyObject *self, PyObject *args, PyObjec
 #define wxInputStream_read(_swigobj,_swigarg0)  (_swigobj->read(_swigarg0))
 static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    wxString * _result;
+    PyObject * _result;
     wxPyInputStream * _arg0;
     int  _arg1 = (int ) -1;
     PyObject * _argo0 = 0;
@@ -542,15 +230,13 @@ static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObje
         }
     }
 {
-        _result = (wxString *)wxInputStream_read(_arg0,_arg1);
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (PyObject *)wxInputStream_read(_arg0,_arg1);
 
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
 }{
-    if (_result) {
-        _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
-        delete _result;
-    }
-    else
-        _resultobj=0;
+  _resultobj = _result;
 }
     return _resultobj;
 }
@@ -558,7 +244,7 @@ static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObje
 #define wxInputStream_readline(_swigobj,_swigarg0)  (_swigobj->readline(_swigarg0))
 static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    wxString * _result;
+    PyObject * _result;
     wxPyInputStream * _arg0;
     int  _arg1 = (int ) -1;
     PyObject * _argo0 = 0;
@@ -575,15 +261,13 @@ static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, Py
         }
     }
 {
-        _result = (wxString *)wxInputStream_readline(_arg0,_arg1);
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (PyObject *)wxInputStream_readline(_arg0,_arg1);
 
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
 }{
-    if (_result) {
-        _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
-        delete _result;
-    }
-    else
-        _resultobj=0;
+  _resultobj = _result;
 }
     return _resultobj;
 }
@@ -591,7 +275,7 @@ static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, Py
 #define wxInputStream_readlines(_swigobj,_swigarg0)  (_swigobj->readlines(_swigarg0))
 static PyObject *_wrap_wxInputStream_readlines(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    wxStringPtrList * _result;
+    PyObject * _result;
     wxPyInputStream * _arg0;
     int  _arg1 = (int ) -1;
     PyObject * _argo0 = 0;
@@ -608,22 +292,13 @@ static PyObject *_wrap_wxInputStream_readlines(PyObject *self, PyObject *args, P
         }
     }
 {
-        _result = (wxStringPtrList *)wxInputStream_readlines(_arg0,_arg1);
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (PyObject *)wxInputStream_readlines(_arg0,_arg1);
 
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
 }{
-    if (_result) {
-        _resultobj = PyList_New(_result->GetCount());
-        wxStringPtrList::Node *node = _result->GetFirst();
-        for (int i=0; node; i++) {
-            wxString *s = node->GetData();
-            PyList_SetItem(_resultobj, i, PyString_FromStringAndSize(s->c_str(), s->Len()));
-            node = node->GetNext();
-            delete s;
-        }
-        delete _result;
-    }
-    else
-        _resultobj=0;
+  _resultobj = _result;
 }
     return _resultobj;
 }
@@ -648,8 +323,11 @@ static PyObject *_wrap_wxInputStream_seek(PyObject *self, PyObject *args, PyObje
         }
     }
 {
-        wxInputStream_seek(_arg0,_arg1,_arg2);
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxInputStream_seek(_arg0,_arg1,_arg2);
 
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
 }    Py_INCREF(Py_None);
     _resultobj = Py_None;
     return _resultobj;
@@ -674,22 +352,260 @@ static PyObject *_wrap_wxInputStream_tell(PyObject *self, PyObject *args, PyObje
         }
     }
 {
-        _result = (int )wxInputStream_tell(_arg0);
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (int )wxInputStream_tell(_arg0);
 
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
 }    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-static void  wxOutputStream_write(wxOutputStream *self,const wxString & str) {
-            self->Write(str.c_str(), str.Length());
+#define wxInputStream_Peek(_swigobj)  (_swigobj->Peek())
+static PyObject *_wrap_wxInputStream_Peek(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    char  _result;
+    wxPyInputStream * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_Peek",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_Peek. Expected _wxPyInputStream_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (char )wxInputStream_Peek(_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("c",_result);
+    return _resultobj;
+}
+
+#define wxInputStream_GetC(_swigobj)  (_swigobj->GetC())
+static PyObject *_wrap_wxInputStream_GetC(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    char  _result;
+    wxPyInputStream * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_GetC",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_GetC. Expected _wxPyInputStream_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (char )wxInputStream_GetC(_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("c",_result);
+    return _resultobj;
+}
+
+#define wxInputStream_LastRead(_swigobj)  (_swigobj->LastRead())
+static PyObject *_wrap_wxInputStream_LastRead(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    size_t  _result;
+    wxPyInputStream * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_LastRead",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_LastRead. Expected _wxPyInputStream_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (size_t )wxInputStream_LastRead(_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxInputStream_CanRead(_swigobj)  (_swigobj->CanRead())
+static PyObject *_wrap_wxInputStream_CanRead(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    bool  _result;
+    wxPyInputStream * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_CanRead",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_CanRead. Expected _wxPyInputStream_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (bool )wxInputStream_CanRead(_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxInputStream_Eof(_swigobj)  (_swigobj->Eof())
+static PyObject *_wrap_wxInputStream_Eof(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    bool  _result;
+    wxPyInputStream * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_Eof",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_Eof. Expected _wxPyInputStream_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (bool )wxInputStream_Eof(_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxInputStream_Ungetch(_swigobj,_swigarg0)  (_swigobj->Ungetch(_swigarg0))
+static PyObject *_wrap_wxInputStream_Ungetch(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    bool  _result;
+    wxPyInputStream * _arg0;
+    char  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","c", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oc:wxInputStream_Ungetch",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_Ungetch. Expected _wxPyInputStream_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (bool )wxInputStream_Ungetch(_arg0,_arg1);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxInputStream_SeekI(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SeekI(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxInputStream_SeekI(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    long  _result;
+    wxPyInputStream * _arg0;
+    long  _arg1;
+    wxSeekMode  _arg2 = (wxSeekMode ) (wxFromStart);
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","pos","mode", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol|i:wxInputStream_SeekI",_kwnames,&_argo0,&_arg1,&_arg2)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_SeekI. Expected _wxPyInputStream_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (long )wxInputStream_SeekI(_arg0,_arg1,_arg2);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("l",_result);
+    return _resultobj;
+}
+
+#define wxInputStream_TellI(_swigobj)  (_swigobj->TellI())
+static PyObject *_wrap_wxInputStream_TellI(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    long  _result;
+    wxPyInputStream * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_TellI",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_TellI. Expected _wxPyInputStream_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (long )wxInputStream_TellI(_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("l",_result);
+    return _resultobj;
+}
+
+static void  wxOutputStream_write(wxOutputStream *self,PyObject * obj) {
+            // We use only strings for the streams, not unicode
+            PyObject* str = PyObject_Str(obj);
+            if (! str) {
+                PyErr_SetString(PyExc_TypeError, "Unable to convert to string");
+                return;
+            }
+            self->Write(PyString_AS_STRING(str),
+                        PyString_GET_SIZE(str));
+            Py_DECREF(str);
         }
 static PyObject *_wrap_wxOutputStream_write(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxOutputStream * _arg0;
-    wxString * _arg1;
+    PyObject * _arg1;
     PyObject * _argo0 = 0;
     PyObject * _obj1 = 0;
-    char *_kwnames[] = { "self","str", NULL };
+    char *_kwnames[] = { "self","obj", NULL };
 
     self = self;
     if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxOutputStream_write",_kwnames,&_argo0,&_obj1)) 
@@ -702,26 +618,29 @@ static PyObject *_wrap_wxOutputStream_write(PyObject *self, PyObject *args, PyOb
         }
     }
 {
-    if (!PyString_Check(_obj1)) {
-        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
-        return NULL;
-    }
-    _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1));
+  _arg1 = _obj1;
 }
 {
-        wxOutputStream_write(_arg0,*_arg1);
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxOutputStream_write(_arg0,_arg1);
 
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
 }    Py_INCREF(Py_None);
     _resultobj = Py_None;
-{
-    if (_obj1)
-        delete _arg1;
-}
     return _resultobj;
 }
 
 static PyMethodDef streamscMethods[] = {
         { "wxOutputStream_write", (PyCFunction) _wrap_wxOutputStream_write, METH_VARARGS | METH_KEYWORDS },
+        { "wxInputStream_TellI", (PyCFunction) _wrap_wxInputStream_TellI, METH_VARARGS | METH_KEYWORDS },
+        { "wxInputStream_SeekI", (PyCFunction) _wrap_wxInputStream_SeekI, METH_VARARGS | METH_KEYWORDS },
+        { "wxInputStream_Ungetch", (PyCFunction) _wrap_wxInputStream_Ungetch, METH_VARARGS | METH_KEYWORDS },
+        { "wxInputStream_Eof", (PyCFunction) _wrap_wxInputStream_Eof, METH_VARARGS | METH_KEYWORDS },
+        { "wxInputStream_CanRead", (PyCFunction) _wrap_wxInputStream_CanRead, METH_VARARGS | METH_KEYWORDS },
+        { "wxInputStream_LastRead", (PyCFunction) _wrap_wxInputStream_LastRead, METH_VARARGS | METH_KEYWORDS },
+        { "wxInputStream_GetC", (PyCFunction) _wrap_wxInputStream_GetC, METH_VARARGS | METH_KEYWORDS },
+        { "wxInputStream_Peek", (PyCFunction) _wrap_wxInputStream_Peek, METH_VARARGS | METH_KEYWORDS },
         { "wxInputStream_tell", (PyCFunction) _wrap_wxInputStream_tell, METH_VARARGS | METH_KEYWORDS },
         { "wxInputStream_seek", (PyCFunction) _wrap_wxInputStream_seek, METH_VARARGS | METH_KEYWORDS },
         { "wxInputStream_readlines", (PyCFunction) _wrap_wxInputStream_readlines, METH_VARARGS | METH_KEYWORDS },
@@ -775,8 +694,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_EBool","_int",0},
     { "_EBool","_wxWindowID",0},
     { "_unsigned_long","_long",0},
-    { "_wxPyInputStream","_class_wxPyInputStream",0},
-    { "_class_wxOutputStream","_wxOutputStream",0},
     { "_signed_int","_wxCoord",0},
     { "_signed_int","_wxPrintQuality",0},
     { "_signed_int","_EBool",0},
@@ -787,7 +704,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_WXTYPE","_unsigned_short",0},
     { "_unsigned_short","_WXTYPE",0},
     { "_unsigned_short","_short",0},
-    { "_class_wxPyInputStream","_wxPyInputStream",0},
     { "_signed_short","_WXTYPE",0},
     { "_signed_short","_short",0},
     { "_unsigned_char","_byte",0},
@@ -835,7 +751,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxCoord","_size_t",0},
     { "_wxCoord","_time_t",0},
     { "_wxCoord","_wxPrintQuality",0},
-    { "_wxOutputStream","_class_wxOutputStream",0},
 {0,0,0}};
 
 static PyObject *SWIG_globals;
@@ -847,6 +762,11 @@ SWIGEXPORT(void) initstreamsc() {
         SWIG_globals = SWIG_newvarlink();
         m = Py_InitModule("streamsc", streamscMethods);
         d = PyModule_GetDict(m);
+        PyDict_SetItemString(d,"wxFromStart", PyInt_FromLong((long) wxFromStart));
+        PyDict_SetItemString(d,"wxFromCurrent", PyInt_FromLong((long) wxFromCurrent));
+        PyDict_SetItemString(d,"wxFromEnd", PyInt_FromLong((long) wxFromEnd));
+
+    wxPyPtrTypeMap_Add("wxInputStream", "wxPyInputStream");
 {
    int i;
    for (i = 0; _swig_mapping[i].n1; i++)