X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cbf60e091efac7f407a650f7ec0fa169be89abd5..a2615ebc22a402b1badb46475f94ab6aa3a64018:/wxPython/src/msw/filesys.cpp diff --git a/wxPython/src/msw/filesys.cpp b/wxPython/src/msw/filesys.cpp index 0cbdf473d1..3632f7079c 100644 --- a/wxPython/src/msw/filesys.cpp +++ b/wxPython/src/msw/filesys.cpp @@ -89,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 { @@ -122,7 +116,7 @@ public: return wxFileSystemHandler::GetRightLocation(location); } - wxString GetMimeTypeFromExt(const wxString& location){ + wxString GetMimeTypeFromExt(const wxString& location) { return wxFileSystemHandler::GetMimeTypeFromExt(location); } @@ -147,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)); } @@ -175,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; } @@ -201,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; @@ -227,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; } @@ -253,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; @@ -278,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; @@ -357,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; } @@ -419,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; @@ -469,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; @@ -504,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; } @@ -535,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; } @@ -566,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; } @@ -598,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; @@ -643,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; @@ -686,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; @@ -716,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; @@ -777,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; @@ -830,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) @@ -886,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; @@ -920,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) @@ -977,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) @@ -1034,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) @@ -1091,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) @@ -1148,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) @@ -1204,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; @@ -1240,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; @@ -1293,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; @@ -1327,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; @@ -1380,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) @@ -1436,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; @@ -1467,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; @@ -1485,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; @@ -1522,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; @@ -1557,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; @@ -1618,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; @@ -1677,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; @@ -1712,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; @@ -1773,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; @@ -1826,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) @@ -1882,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; @@ -1923,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; @@ -1947,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; @@ -2000,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; @@ -2061,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; @@ -2114,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) @@ -2170,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;