X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/94082a71f84ab25defd0b31ff60e9993b73df66a..835ce09e8d5f2bf2d81709b2a7dc9740996748c1:/wxPython/src/gtk/filesys.cpp diff --git a/wxPython/src/gtk/filesys.cpp b/wxPython/src/gtk/filesys.cpp index 0b2186bfbe..17f46c587d 100644 --- a/wxPython/src/gtk/filesys.cpp +++ b/wxPython/src/gtk/filesys.cpp @@ -56,6 +56,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "filesysc" #include "helpers.h" +#include "pyistream.h" #include #include #include @@ -88,12 +89,6 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { return target; } -#if PYTHON_API_VERSION >= 1009 - static char* wxStringErrorMsg = "String or Unicode type required"; -#else - static char* wxStringErrorMsg = "String type required"; -#endif - // wxPyFileSystemHandler will be the Python class wxFileSystemHandler and handling // the callback functions class wxPyFileSystemHandler : public wxFileSystemHandler { @@ -121,7 +116,7 @@ public: return wxFileSystemHandler::GetRightLocation(location); } - wxString GetMimeTypeFromExt(const wxString& location){ + wxString GetMimeTypeFromExt(const wxString& location) { return wxFileSystemHandler::GetMimeTypeFromExt(location); } @@ -146,15 +141,11 @@ void __wxMemoryFSHandler_AddFile_wxBitmap(const wxString& filename, wxMemoryFSHandler::AddFile(filename, bitmap, type); } -// void __wxMemoryFSHandler_AddFile_wxString(const wxString& filename, -// const wxString& textdata) { -// wxMemoryFSHandler::AddFile(filename, textdata); -// } - void __wxMemoryFSHandler_AddFile_Data(const wxString& filename, PyObject* data) { wxMemoryFSHandler::AddFile(filename, + // TODO: Verify data type (void*)PyString_AsString(data), (size_t)PyString_Size(data)); } @@ -174,22 +165,9 @@ static PyObject *_wrap___wxMemoryFSHandler_AddFile_wxImage(PyObject *self, PyObj if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOl:__wxMemoryFSHandler_AddFile_wxImage",_kwnames,&_obj0,&_argo1,&_arg2)) return NULL; { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj0) && !PyUnicode_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg0 = wxString_in_helper(_obj0); + if (_arg0 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj0, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg0 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg0 = new wxString(PyString_AS_STRING(_obj0), PyString_GET_SIZE(_obj0)); -#endif } if (_argo1) { if (_argo1 == Py_None) { _arg1 = NULL; } @@ -200,7 +178,7 @@ static PyObject *_wrap___wxMemoryFSHandler_AddFile_wxImage(PyObject *self, PyObj } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - __wxMemoryFSHandler_AddFile_wxImage(*_arg0,*_arg1,_arg2); + __wxMemoryFSHandler_AddFile_wxImage(*_arg0,*_arg1,_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -226,22 +204,9 @@ static PyObject *_wrap___wxMemoryFSHandler_AddFile_wxBitmap(PyObject *self, PyOb if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOl:__wxMemoryFSHandler_AddFile_wxBitmap",_kwnames,&_obj0,&_argo1,&_arg2)) return NULL; { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj0) && !PyUnicode_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg0 = wxString_in_helper(_obj0); + if (_arg0 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj0, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg0 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg0 = new wxString(PyString_AS_STRING(_obj0), PyString_GET_SIZE(_obj0)); -#endif } if (_argo1) { if (_argo1 == Py_None) { _arg1 = NULL; } @@ -252,7 +217,7 @@ static PyObject *_wrap___wxMemoryFSHandler_AddFile_wxBitmap(PyObject *self, PyOb } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - __wxMemoryFSHandler_AddFile_wxBitmap(*_arg0,*_arg1,_arg2); + __wxMemoryFSHandler_AddFile_wxBitmap(*_arg0,*_arg1,_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -277,29 +242,16 @@ static PyObject *_wrap___wxMemoryFSHandler_AddFile_Data(PyObject *self, PyObject if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:__wxMemoryFSHandler_AddFile_Data",_kwnames,&_obj0,&_obj1)) return NULL; { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj0) && !PyUnicode_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj0, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg0 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg0 = wxString_in_helper(_obj0); + if (_arg0 == NULL) return NULL; - } - _arg0 = new wxString(PyString_AS_STRING(_obj0), PyString_GET_SIZE(_obj0)); -#endif } { _arg1 = _obj1; } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - __wxMemoryFSHandler_AddFile_Data(*_arg0,_arg1); + __wxMemoryFSHandler_AddFile_Data(*_arg0,_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -356,58 +308,19 @@ static PyObject *_wrap_new_wxFSFile(PyObject *self, PyObject *args, PyObject *kw } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg2 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) return NULL; - } - _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2)); -#endif } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj3) && !PyUnicode_Check(_obj3)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj3, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg3 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj3)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg3 = wxString_in_helper(_obj3); + if (_arg3 == NULL) return NULL; - } - _arg3 = new wxString(PyString_AS_STRING(_obj3), PyString_GET_SIZE(_obj3)); -#endif } if (_argo4) { if (_argo4 == Py_None) { _arg4 = NULL; } @@ -418,7 +331,7 @@ static PyObject *_wrap_new_wxFSFile(PyObject *self, PyObject *args, PyObject *kw } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxFSFile *)new_wxFSFile(_arg0,*_arg1,*_arg2,*_arg3,*_arg4); + _result = (wxFSFile *)new_wxFSFile(_arg0,*_arg1,*_arg2,*_arg3,*_arg4); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -468,7 +381,7 @@ static PyObject *_wrap_wxFSFile_GetStream(PyObject *self, PyObject *args, PyObje } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxInputStream *)wxFSFile_GetStream(_arg0); + _result = (wxInputStream *)wxFSFile_GetStream(_arg0); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -503,13 +416,17 @@ static PyObject *_wrap_wxFSFile_GetMimeType(PyObject *self, PyObject *args, PyOb } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - const wxString & _result_ref = wxFSFile_GetMimeType(_arg0); + const wxString & _result_ref = wxFSFile_GetMimeType(_arg0); _result = (wxString *) &_result_ref; wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } return _resultobj; } @@ -534,13 +451,17 @@ static PyObject *_wrap_wxFSFile_GetLocation(PyObject *self, PyObject *args, PyOb } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - const wxString & _result_ref = wxFSFile_GetLocation(_arg0); + const wxString & _result_ref = wxFSFile_GetLocation(_arg0); _result = (wxString *) &_result_ref; wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } return _resultobj; } @@ -565,13 +486,17 @@ static PyObject *_wrap_wxFSFile_GetAnchor(PyObject *self, PyObject *args, PyObje } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - const wxString & _result_ref = wxFSFile_GetAnchor(_arg0); + const wxString & _result_ref = wxFSFile_GetAnchor(_arg0); _result = (wxString *) &_result_ref; wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } return _resultobj; } @@ -597,7 +522,7 @@ static PyObject *_wrap_wxFSFile_GetModificationTime(PyObject *self, PyObject *ar } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxDateTime (wxFSFile_GetModificationTime(_arg0)); + _result = new wxDateTime (wxFSFile_GetModificationTime(_arg0)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -642,7 +567,7 @@ static PyObject *_wrap_new_wxFileSystemHandler(PyObject *self, PyObject *args, P return NULL; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxPyFileSystemHandler *)new_wxFileSystemHandler(); + _result = (wxPyFileSystemHandler *)new_wxFileSystemHandler(); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -685,7 +610,7 @@ static PyObject *_wrap_wxFileSystemHandler__setCallbackInfo(PyObject *self, PyOb } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxFileSystemHandler__setCallbackInfo(_arg0,_arg1,_arg2); + wxFileSystemHandler__setCallbackInfo(_arg0,_arg1,_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -715,26 +640,13 @@ static PyObject *_wrap_wxFileSystemHandler_CanOpen(PyObject *self, PyObject *arg } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (bool )wxFileSystemHandler_CanOpen(_arg0,*_arg1); + _result = (bool )wxFileSystemHandler_CanOpen(_arg0,*_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -776,26 +688,13 @@ static PyObject *_wrap_wxFileSystemHandler_OpenFile(PyObject *self, PyObject *ar } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg2 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) return NULL; - } - _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxFSFile *)wxFileSystemHandler_OpenFile(_arg0,*_arg1,*_arg2); + _result = (wxFSFile *)wxFileSystemHandler_OpenFile(_arg0,*_arg1,*_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -829,31 +728,22 @@ static PyObject *_wrap_wxFileSystemHandler_FindFirst(PyObject *self, PyObject *a } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxFileSystemHandler_FindFirst(_arg0,*_arg1,_arg2)); + _result = new wxString (wxFileSystemHandler_FindFirst(_arg0,*_arg1,_arg2)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { if (_obj1) @@ -885,12 +775,16 @@ static PyObject *_wrap_wxFileSystemHandler_FindNext(PyObject *self, PyObject *ar } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxFileSystemHandler_FindNext(_arg0)); + _result = new wxString (wxFileSystemHandler_FindNext(_arg0)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { delete _result; @@ -919,31 +813,22 @@ static PyObject *_wrap_wxFileSystemHandler_GetProtocol(PyObject *self, PyObject } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxFileSystemHandler_GetProtocol(_arg0,*_arg1)); + _result = new wxString (wxFileSystemHandler_GetProtocol(_arg0,*_arg1)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { if (_obj1) @@ -976,31 +861,22 @@ static PyObject *_wrap_wxFileSystemHandler_GetLeftLocation(PyObject *self, PyObj } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxFileSystemHandler_GetLeftLocation(_arg0,*_arg1)); + _result = new wxString (wxFileSystemHandler_GetLeftLocation(_arg0,*_arg1)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { if (_obj1) @@ -1033,31 +909,22 @@ static PyObject *_wrap_wxFileSystemHandler_GetAnchor(PyObject *self, PyObject *a } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxFileSystemHandler_GetAnchor(_arg0,*_arg1)); + _result = new wxString (wxFileSystemHandler_GetAnchor(_arg0,*_arg1)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { if (_obj1) @@ -1090,31 +957,22 @@ static PyObject *_wrap_wxFileSystemHandler_GetRightLocation(PyObject *self, PyOb } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxFileSystemHandler_GetRightLocation(_arg0,*_arg1)); + _result = new wxString (wxFileSystemHandler_GetRightLocation(_arg0,*_arg1)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { if (_obj1) @@ -1147,31 +1005,22 @@ static PyObject *_wrap_wxFileSystemHandler_GetMimeTypeFromExt(PyObject *self, Py } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxFileSystemHandler_GetMimeTypeFromExt(_arg0,*_arg1)); + _result = new wxString (wxFileSystemHandler_GetMimeTypeFromExt(_arg0,*_arg1)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { if (_obj1) @@ -1203,7 +1052,7 @@ static PyObject *_wrap_new_wxFileSystem(PyObject *self, PyObject *args, PyObject return NULL; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxFileSystem *)new_wxFileSystem(); + _result = (wxFileSystem *)new_wxFileSystem(); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1239,27 +1088,14 @@ static PyObject *_wrap_wxFileSystem_ChangePathTo(PyObject *self, PyObject *args, } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } _arg2 = (bool ) tempbool2; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxFileSystem_ChangePathTo(_arg0,*_arg1,_arg2); + wxFileSystem_ChangePathTo(_arg0,*_arg1,_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1292,12 +1128,16 @@ static PyObject *_wrap_wxFileSystem_GetPath(PyObject *self, PyObject *args, PyOb } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxFileSystem_GetPath(_arg0)); + _result = new wxString (wxFileSystem_GetPath(_arg0)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { delete _result; @@ -1326,26 +1166,13 @@ static PyObject *_wrap_wxFileSystem_OpenFile(PyObject *self, PyObject *args, PyO } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxFSFile *)wxFileSystem_OpenFile(_arg0,*_arg1); + _result = (wxFSFile *)wxFileSystem_OpenFile(_arg0,*_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1379,31 +1206,22 @@ static PyObject *_wrap_wxFileSystem_FindFirst(PyObject *self, PyObject *args, Py } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxFileSystem_FindFirst(_arg0,*_arg1,_arg2)); + _result = new wxString (wxFileSystem_FindFirst(_arg0,*_arg1,_arg2)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { if (_obj1) @@ -1435,12 +1253,16 @@ static PyObject *_wrap_wxFileSystem_FindNext(PyObject *self, PyObject *args, PyO } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxFileSystem_FindNext(_arg0)); + _result = new wxString (wxFileSystem_FindNext(_arg0)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { delete _result; @@ -1466,7 +1288,7 @@ static PyObject *_wrap_wxFileSystem_AddHandler(PyObject *self, PyObject *args, P } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxFileSystem::AddHandler(_arg0); + wxFileSystem::AddHandler(_arg0); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1484,7 +1306,7 @@ static PyObject *_wrap_wxFileSystem_CleanUpHandlers(PyObject *self, PyObject *ar return NULL; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxFileSystem::CleanUpHandlers(); + wxFileSystem::CleanUpHandlers(); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1521,7 +1343,7 @@ static PyObject *_wrap_new_wxInternetFSHandler(PyObject *self, PyObject *args, P return NULL; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxInternetFSHandler *)new_wxInternetFSHandler(); + _result = (wxInternetFSHandler *)new_wxInternetFSHandler(); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1556,26 +1378,13 @@ static PyObject *_wrap_wxInternetFSHandler_CanOpen(PyObject *self, PyObject *arg } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (bool )wxInternetFSHandler_CanOpen(_arg0,*_arg1); + _result = (bool )wxInternetFSHandler_CanOpen(_arg0,*_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1617,26 +1426,13 @@ static PyObject *_wrap_wxInternetFSHandler_OpenFile(PyObject *self, PyObject *ar } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1) + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) return NULL; - _arg2 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxFSFile *)wxInternetFSHandler_OpenFile(_arg0,*_arg1,*_arg2); + _result = (wxFSFile *)wxInternetFSHandler_OpenFile(_arg0,*_arg1,*_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1676,7 +1472,7 @@ static PyObject *_wrap_new_wxZipFSHandler(PyObject *self, PyObject *args, PyObje return NULL; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxZipFSHandler *)new_wxZipFSHandler(); + _result = (wxZipFSHandler *)new_wxZipFSHandler(); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1711,26 +1507,13 @@ static PyObject *_wrap_wxZipFSHandler_CanOpen(PyObject *self, PyObject *args, Py } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (bool )wxZipFSHandler_CanOpen(_arg0,*_arg1); + _result = (bool )wxZipFSHandler_CanOpen(_arg0,*_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1772,26 +1555,13 @@ static PyObject *_wrap_wxZipFSHandler_OpenFile(PyObject *self, PyObject *args, P } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1) + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) return NULL; - _arg2 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxFSFile *)wxZipFSHandler_OpenFile(_arg0,*_arg1,*_arg2); + _result = (wxFSFile *)wxZipFSHandler_OpenFile(_arg0,*_arg1,*_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1825,31 +1595,22 @@ static PyObject *_wrap_wxZipFSHandler_FindFirst(PyObject *self, PyObject *args, } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxZipFSHandler_FindFirst(_arg0,*_arg1,_arg2)); + _result = new wxString (wxZipFSHandler_FindFirst(_arg0,*_arg1,_arg2)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { if (_obj1) @@ -1881,12 +1642,16 @@ static PyObject *_wrap_wxZipFSHandler_FindNext(PyObject *self, PyObject *args, P } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxZipFSHandler_FindNext(_arg0)); + _result = new wxString (wxZipFSHandler_FindNext(_arg0)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { delete _result; @@ -1922,7 +1687,7 @@ static PyObject *_wrap_new_wxMemoryFSHandler(PyObject *self, PyObject *args, PyO return NULL; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxMemoryFSHandler *)new_wxMemoryFSHandler(); + _result = (wxMemoryFSHandler *)new_wxMemoryFSHandler(); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1946,26 +1711,13 @@ static PyObject *_wrap_wxMemoryFSHandler_RemoveFile(PyObject *self, PyObject *ar if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxMemoryFSHandler_RemoveFile",_kwnames,&_obj0)) return NULL; { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj0) && !PyUnicode_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj0, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg0 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg0 = wxString_in_helper(_obj0); + if (_arg0 == NULL) return NULL; - } - _arg0 = new wxString(PyString_AS_STRING(_obj0), PyString_GET_SIZE(_obj0)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxMemoryFSHandler::RemoveFile(*_arg0); + wxMemoryFSHandler::RemoveFile(*_arg0); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -1999,26 +1751,13 @@ static PyObject *_wrap_wxMemoryFSHandler_CanOpen(PyObject *self, PyObject *args, } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (bool )wxMemoryFSHandler_CanOpen(_arg0,*_arg1); + _result = (bool )wxMemoryFSHandler_CanOpen(_arg0,*_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -2060,26 +1799,13 @@ static PyObject *_wrap_wxMemoryFSHandler_OpenFile(PyObject *self, PyObject *args } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg2 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) return NULL; - } - _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxFSFile *)wxMemoryFSHandler_OpenFile(_arg0,*_arg1,*_arg2); + _result = (wxFSFile *)wxMemoryFSHandler_OpenFile(_arg0,*_arg1,*_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -2113,31 +1839,22 @@ static PyObject *_wrap_wxMemoryFSHandler_FindFirst(PyObject *self, PyObject *arg } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxMemoryFSHandler_FindFirst(_arg0,*_arg1,_arg2)); + _result = new wxString (wxMemoryFSHandler_FindFirst(_arg0,*_arg1,_arg2)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { if (_obj1) @@ -2169,12 +1886,16 @@ static PyObject *_wrap_wxMemoryFSHandler_FindNext(PyObject *self, PyObject *args } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxMemoryFSHandler_FindNext(_arg0)); + _result = new wxString (wxMemoryFSHandler_FindNext(_arg0)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { delete _result;