X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c8bc7bb84dcca816055d5876e4772551c48acda5..7108497a54ee5de03bcea8de85e2750116c223e6:/wxPython/src/msw/utils.cpp?ds=sidebyside diff --git a/wxPython/src/msw/utils.cpp b/wxPython/src/msw/utils.cpp index 6356d1ec79..a5b946a624 100644 --- a/wxPython/src/msw/utils.cpp +++ b/wxPython/src/msw/utils.cpp @@ -55,11 +55,16 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "utilsc" -#include "export.h" +#include "helpers.h" #include #include #include + // Put some wx default wxChar* values into wxStrings. + DECLARE_DEF_STRING2(DateFormatStr, wxT("%c")); + static const wxString wxPyEmptyString(wxT("")); + + static PyObject* t_output_helper(PyObject* target, PyObject* o) { PyObject* o2; @@ -961,7 +966,7 @@ static PyObject *_wrap_wxConfigBase_Read(PyObject *self, PyObject *args, PyObjec wxString * _result; wxConfigBase * _arg0; wxString * _arg1; - wxString * _arg2 = (wxString *) &wxEmptyString; + wxString * _arg2 = (wxString *) &wxPyEmptyString; PyObject * _argo0 = 0; PyObject * _obj1 = 0; PyObject * _obj2 = 0; @@ -1756,10 +1761,10 @@ static void *SwigwxConfigTowxConfigBase(void *ptr) { static PyObject *_wrap_new_wxConfig(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxConfig * _result; - wxString * _arg0 = (wxString *) &wxEmptyString; - wxString * _arg1 = (wxString *) &wxEmptyString; - wxString * _arg2 = (wxString *) &wxEmptyString; - wxString * _arg3 = (wxString *) &wxEmptyString; + wxString * _arg0 = (wxString *) &wxPyEmptyString; + wxString * _arg1 = (wxString *) &wxPyEmptyString; + wxString * _arg2 = (wxString *) &wxPyEmptyString; + wxString * _arg3 = (wxString *) &wxPyEmptyString; long _arg4 = (long ) 0; PyObject * _obj0 = 0; PyObject * _obj1 = 0; @@ -1867,10 +1872,10 @@ static void *SwigwxFileConfigTowxConfigBase(void *ptr) { static PyObject *_wrap_new_wxFileConfig(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxFileConfig * _result; - wxString * _arg0 = (wxString *) &wxEmptyString; - wxString * _arg1 = (wxString *) &wxEmptyString; - wxString * _arg2 = (wxString *) &wxEmptyString; - wxString * _arg3 = (wxString *) &wxEmptyString; + wxString * _arg0 = (wxString *) &wxPyEmptyString; + wxString * _arg1 = (wxString *) &wxPyEmptyString; + wxString * _arg2 = (wxString *) &wxPyEmptyString; + wxString * _arg3 = (wxString *) &wxPyEmptyString; long _arg4 = (long ) 0; PyObject * _obj0 = 0; PyObject * _obj1 = 0; @@ -5080,9 +5085,10 @@ static PyObject *_wrap_wxDateTime___sub__DS(PyObject *self, PyObject *args, PyOb return _resultobj; } -static int wxDateTime___cmp__(wxDateTime *self,const wxDateTime & other) { - if (*self < other) return -1; - if (*self == other) return 0; +static int wxDateTime___cmp__(wxDateTime *self,const wxDateTime * other) { + if (! other) return -1; + if (*self < *other) return -1; + if (*self == *other) return 0; return 1; } static PyObject *_wrap_wxDateTime___cmp__(PyObject *self, PyObject *args, PyObject *kwargs) { @@ -5113,7 +5119,7 @@ static PyObject *_wrap_wxDateTime___cmp__(PyObject *self, PyObject *args, PyObje } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (int )wxDateTime___cmp__(_arg0,*_arg1); + _result = (int )wxDateTime___cmp__(_arg0,_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -5121,17 +5127,24 @@ static PyObject *_wrap_wxDateTime___cmp__(PyObject *self, PyObject *args, PyObje return _resultobj; } -#define wxDateTime_ParseRfc822Date(_swigobj,_swigarg0) (_swigobj->ParseRfc822Date(_swigarg0)) +static int wxDateTime_ParseRfc822Date(wxDateTime *self,const wxString & date) { + const wxChar* rv; + const wxChar* _date = date; + rv = self->ParseRfc822Date(_date); + if (rv == NULL) return -1; + return rv - _date; + } static PyObject *_wrap_wxDateTime_ParseRfc822Date(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - char * _result; + int _result; wxDateTime * _arg0; - wxChar * _arg1; + wxString * _arg1; PyObject * _argo0 = 0; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","date", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxDateTime_ParseRfc822Date",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDateTime_ParseRfc822Date",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5140,30 +5153,47 @@ static PyObject *_wrap_wxDateTime_ParseRfc822Date(PyObject *self, PyObject *args return NULL; } } +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (char *)wxDateTime_ParseRfc822Date(_arg0,_arg1); + _result = (int )wxDateTime_ParseRfc822Date(_arg0,*_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; -} _resultobj = Py_BuildValue("s", _result); +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj1) + delete _arg1; +} return _resultobj; } -#define wxDateTime_ParseFormat(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->ParseFormat(_swigarg0,_swigarg1,_swigarg2)) +static int wxDateTime_ParseFormat(wxDateTime *self,const wxString & date,const wxString & format,const wxDateTime & dateDef) { + const wxChar* rv; + const wxChar* _date = date; + rv = self->ParseFormat(_date, format, dateDef); + if (rv == NULL) return -1; + return rv - _date; + } static PyObject *_wrap_wxDateTime_ParseFormat(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - char * _result; + int _result; wxDateTime * _arg0; - wxChar * _arg1; - wxChar * _arg2 = (wxChar *) "%c"; + wxString * _arg1; + wxString * _arg2 = (wxString *) &wxPyDateFormatStr; wxDateTime * _arg3 = (wxDateTime *) &wxDefaultDateTime; PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + PyObject * _obj2 = 0; PyObject * _argo3 = 0; char *_kwnames[] = { "self","date","format","dateDef", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os|sO:wxDateTime_ParseFormat",_kwnames,&_argo0,&_arg1,&_arg2,&_argo3)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|OO:wxDateTime_ParseFormat",_kwnames,&_argo0,&_obj1,&_obj2,&_argo3)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5172,6 +5202,17 @@ static PyObject *_wrap_wxDateTime_ParseFormat(PyObject *self, PyObject *args, Py return NULL; } } +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} + if (_obj2) +{ + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) + return NULL; +} if (_argo3) { if (_argo3 == Py_None) { _arg3 = NULL; } else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxDateTime_p")) { @@ -5181,25 +5222,40 @@ static PyObject *_wrap_wxDateTime_ParseFormat(PyObject *self, PyObject *args, Py } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (char *)wxDateTime_ParseFormat(_arg0,_arg1,_arg2,*_arg3); + _result = (int )wxDateTime_ParseFormat(_arg0,*_arg1,*_arg2,*_arg3); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; -} _resultobj = Py_BuildValue("s", _result); +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj1) + delete _arg1; +} +{ + if (_obj2) + delete _arg2; +} return _resultobj; } -#define wxDateTime_ParseDateTime(_swigobj,_swigarg0) (_swigobj->ParseDateTime(_swigarg0)) +static int wxDateTime_ParseDateTime(wxDateTime *self,const wxString & datetime) { + const wxChar* rv; + const wxChar* _datetime = datetime; + rv = self->ParseDateTime(_datetime); + if (rv == NULL) return -1; + return rv - _datetime; + } static PyObject *_wrap_wxDateTime_ParseDateTime(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - char * _result; + int _result; wxDateTime * _arg0; - wxChar * _arg1; + wxString * _arg1; PyObject * _argo0 = 0; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","datetime", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxDateTime_ParseDateTime",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDateTime_ParseDateTime",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5208,27 +5264,43 @@ static PyObject *_wrap_wxDateTime_ParseDateTime(PyObject *self, PyObject *args, return NULL; } } +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (char *)wxDateTime_ParseDateTime(_arg0,_arg1); + _result = (int )wxDateTime_ParseDateTime(_arg0,*_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; -} _resultobj = Py_BuildValue("s", _result); +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj1) + delete _arg1; +} return _resultobj; } -#define wxDateTime_ParseDate(_swigobj,_swigarg0) (_swigobj->ParseDate(_swigarg0)) +static int wxDateTime_ParseDate(wxDateTime *self,const wxString & date) { + const wxChar* rv; + const wxChar* _date = date; + rv = self->ParseDate(_date); + if (rv == NULL) return -1; + return rv - _date; + } static PyObject *_wrap_wxDateTime_ParseDate(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - char * _result; + int _result; wxDateTime * _arg0; - wxChar * _arg1; + wxString * _arg1; PyObject * _argo0 = 0; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","date", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxDateTime_ParseDate",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDateTime_ParseDate",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5237,27 +5309,43 @@ static PyObject *_wrap_wxDateTime_ParseDate(PyObject *self, PyObject *args, PyOb return NULL; } } +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (char *)wxDateTime_ParseDate(_arg0,_arg1); + _result = (int )wxDateTime_ParseDate(_arg0,*_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; -} _resultobj = Py_BuildValue("s", _result); +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj1) + delete _arg1; +} return _resultobj; } -#define wxDateTime_ParseTime(_swigobj,_swigarg0) (_swigobj->ParseTime(_swigarg0)) +static int wxDateTime_ParseTime(wxDateTime *self,const wxString & time) { + const wxChar* rv; + const wxChar* _time = time; + rv = self->ParseTime(_time); + if (rv == NULL) return -1; + return rv - _time; + } static PyObject *_wrap_wxDateTime_ParseTime(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - char * _result; + int _result; wxDateTime * _arg0; - wxChar * _arg1; + wxString * _arg1; PyObject * _argo0 = 0; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","time", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxDateTime_ParseTime",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDateTime_ParseTime",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5266,13 +5354,22 @@ static PyObject *_wrap_wxDateTime_ParseTime(PyObject *self, PyObject *args, PyOb return NULL; } } +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (char *)wxDateTime_ParseTime(_arg0,_arg1); + _result = (int )wxDateTime_ParseTime(_arg0,*_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; -} _resultobj = Py_BuildValue("s", _result); +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj1) + delete _arg1; +} return _resultobj; } @@ -5281,14 +5378,15 @@ static PyObject *_wrap_wxDateTime_Format(PyObject *self, PyObject *args, PyObjec PyObject * _resultobj; wxString * _result; wxDateTime * _arg0; - wxChar * _arg1 = (wxChar *) "%c"; + wxString * _arg1 = (wxString *) &wxPyDateFormatStr; wxDateTime::TimeZone * _arg2 = (wxDateTime::TimeZone *) &LOCAL; PyObject * _argo0 = 0; + PyObject * _obj1 = 0; PyObject * _obj2 = 0; char *_kwnames[] = { "self","format","tz", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|sO:wxDateTime_Format",_kwnames,&_argo0,&_arg1,&_obj2)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|OO:wxDateTime_Format",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5297,13 +5395,19 @@ static PyObject *_wrap_wxDateTime_Format(PyObject *self, PyObject *args, PyObjec return NULL; } } + if (_obj1) +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} if (_obj2) { _arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(_obj2)); } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxDateTime_Format(_arg0,_arg1,*_arg2)); + _result = new wxString (wxDateTime_Format(_arg0,*_arg1,*_arg2)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -5314,6 +5418,10 @@ static PyObject *_wrap_wxDateTime_Format(PyObject *self, PyObject *args, PyObjec _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); #endif } +{ + if (_obj1) + delete _arg1; +} { if (_arg2) delete _arg2; } @@ -6097,9 +6205,10 @@ static PyObject *_wrap_wxTimeSpan___neg__(PyObject *self, PyObject *args, PyObje return _resultobj; } -static int wxTimeSpan___cmp__(wxTimeSpan *self,const wxTimeSpan & other) { - if (*self < other) return -1; - if (*self == other) return 0; +static int wxTimeSpan___cmp__(wxTimeSpan *self,const wxTimeSpan * other) { + if (! other) return -1; + if (*self < *other) return -1; + if (*self == *other) return 0; return 1; } static PyObject *_wrap_wxTimeSpan___cmp__(PyObject *self, PyObject *args, PyObject *kwargs) { @@ -6130,7 +6239,7 @@ static PyObject *_wrap_wxTimeSpan___cmp__(PyObject *self, PyObject *args, PyObje } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (int )wxTimeSpan___cmp__(_arg0,*_arg1); + _result = (int )wxTimeSpan___cmp__(_arg0,_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -6528,12 +6637,13 @@ static PyObject *_wrap_wxTimeSpan_Format(PyObject *self, PyObject *args, PyObjec PyObject * _resultobj; wxString * _result; wxTimeSpan * _arg0; - wxChar * _arg1 = (wxChar *) "%c"; + wxString * _arg1 = (wxString *) &wxPyDateFormatStr; PyObject * _argo0 = 0; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","format", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|s:wxTimeSpan_Format",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|O:wxTimeSpan_Format",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -6542,9 +6652,15 @@ static PyObject *_wrap_wxTimeSpan_Format(PyObject *self, PyObject *args, PyObjec return NULL; } } + if (_obj1) +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxTimeSpan_Format(_arg0,_arg1)); + _result = new wxString (wxTimeSpan_Format(_arg0,*_arg1)); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -6555,6 +6671,10 @@ static PyObject *_wrap_wxTimeSpan_Format(PyObject *self, PyObject *args, PyObjec _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); #endif } +{ + if (_obj1) + delete _arg1; +} { delete _result; } @@ -7747,9 +7867,11 @@ SWIGEXPORT(void) initutilsc() { PyDict_SetItemString(d,"wxCONFIG_USE_LOCAL_FILE", PyInt_FromLong((long) wxCONFIG_USE_LOCAL_FILE)); PyDict_SetItemString(d,"wxCONFIG_USE_GLOBAL_FILE", PyInt_FromLong((long) wxCONFIG_USE_GLOBAL_FILE)); PyDict_SetItemString(d,"wxCONFIG_USE_RELATIVE_PATH", PyInt_FromLong((long) wxCONFIG_USE_RELATIVE_PATH)); + PyDict_SetItemString(d,"wxCONFIG_USE_NO_ESCAPE_CHARACTERS", PyInt_FromLong((long) wxCONFIG_USE_NO_ESCAPE_CHARACTERS)); - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); + // These are no longer needed since utils is back in the core +// wxClassInfo::CleanUpClasses(); +// wxClassInfo::InitializeClasses(); PyDict_SetItemString(d,"wxConfigBase_Type_Unknown", PyInt_FromLong((long) wxConfigBase::Type_Unknown)); PyDict_SetItemString(d,"wxConfigBase_Type_String", PyInt_FromLong((long) wxConfigBase::Type_String)); PyDict_SetItemString(d,"wxConfigBase_Type_Boolean", PyInt_FromLong((long) wxConfigBase::Type_Boolean));