From a7bc962ce5dce32cab111eeef3db7aab07d70551 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Fri, 12 May 2017 23:11:38 +0200 Subject: [PATCH] Renaming getPyDict to getPyObject for consistency with BaseClass --- src/Base/Exception.cpp | 8 ++++---- src/Base/Exception.h | 8 ++++---- src/Base/ExceptionFactory.h | 2 +- src/Tools/generateTemplates/templateClassPyExport.py | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index f48a799d0ee5..2ca59f29e5c9 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -98,7 +98,7 @@ void Exception::ReportException (void) const Console().Error("Exception (%s): %s \n",Console().Time(),str.c_str()); } -PyObject * Exception::getPyDict() const +PyObject * Exception::getPyObject(void) const { PyObject *edict = PyDict_New(); @@ -112,7 +112,7 @@ PyObject * Exception::getPyDict() const return edict; } -void Exception::setPyDict( PyObject * pydict) +void Exception::setPyObject( PyObject * pydict) { if(pydict!=NULL) { PyObject *pystring; @@ -283,7 +283,7 @@ void FileException::ReportException (void) const Console().Error("Exception (%s): %s \n",Console().Time(),str.c_str()); } -PyObject * FileException::getPyDict() const +PyObject * FileException::getPyObject(void) const { PyObject *edict = PyDict_New(); @@ -298,7 +298,7 @@ PyObject * FileException::getPyDict() const return edict; } -void FileException::setPyDict( PyObject * pydict) +void FileException::setPyObject( PyObject * pydict) { if(pydict!=NULL) { PyObject *pystring; diff --git a/src/Base/Exception.h b/src/Base/Exception.h index b8cc3d98b820..0661f0e03996 100644 --- a/src/Base/Exception.h +++ b/src/Base/Exception.h @@ -85,9 +85,9 @@ class BaseExport Exception : public BaseClass /// intended to use via macro for autofilling of debugging information inline void setDebugInformation(const std::string & file, const int line, const std::string & function); /// returns a Python dictionary containing the exception data - virtual PyObject * getPyDict() const; + virtual PyObject * getPyObject(void) const; /// returns sets the exception data from a Python dictionary - virtual void setPyDict( PyObject * pydict); + virtual void setPyObject( PyObject * pydict); protected: public: // FIXME: Remove the public keyword @@ -193,9 +193,9 @@ class BaseExport FileException : public Exception /// Get file name for use with tranlatable message std::string getFileName() const; /// returns a Python dictionary containing the exception data - virtual PyObject * getPyDict() const; + virtual PyObject * getPyObject(void) const; /// returns sets the exception data from a Python dictionary - virtual void setPyDict( PyObject * pydict); + virtual void setPyObject( PyObject * pydict); protected: FileInfo file; // necesary for what() legacy behaviour as it returns a buffer that can not be of a temporary object to be destroyed at end of what() diff --git a/src/Base/ExceptionFactory.h b/src/Base/ExceptionFactory.h index 178783920338..7e9384c51d09 100644 --- a/src/Base/ExceptionFactory.h +++ b/src/Base/ExceptionFactory.h @@ -80,7 +80,7 @@ class BaseExport ExceptionProducer : public AbstractExceptionProducer { CLASS c; - c.setPyDict(pydict); + c.setPyObject(pydict); throw c; } diff --git a/src/Tools/generateTemplates/templateClassPyExport.py b/src/Tools/generateTemplates/templateClassPyExport.py index dac3bb98c2ae..345dc6a5c4c9 100644 --- a/src/Tools/generateTemplates/templateClassPyExport.py +++ b/src/Tools/generateTemplates/templateClassPyExport.py @@ -494,7 +494,7 @@ class @self.export.Namespace@Export @self.export.Name@ : public @self.export.Fat } catch(const Base::Exception& e) // catch the FreeCAD exceptions { - PyObject *edict = e.getPyDict(); + PyObject *edict = e.getPyObject(); e.ReportException(); PyErr_SetObject(Base::BaseExceptionFreeCADError, edict); @@ -684,7 +684,7 @@ class @self.export.Namespace@Export @self.export.Name@ : public @self.export.Fat #ifndef DONT_CATCH_CXX_EXCEPTIONS catch(const Base::Exception& e) // catch the FreeCAD exceptions { - PyObject *edict = e.getPyDict(); + PyObject *edict = e.getPyObject(); e.ReportException(); PyErr_SetObject(Base::BaseExceptionFreeCADError, edict); @@ -714,7 +714,7 @@ class @self.export.Namespace@Export @self.export.Name@ : public @self.export.Fat #else // DONT_CATCH_CXX_EXCEPTIONS catch(const Base::Exception& e) // catch the FreeCAD exceptions { - PyObject *edict = e.getPyDict(); + PyObject *edict = e.getPyObject(); e.ReportException(); PyErr_SetObject(Base::BaseExceptionFreeCADError, edict); @@ -757,7 +757,7 @@ class @self.export.Namespace@Export @self.export.Name@ : public @self.export.Fat #ifndef DONT_CATCH_CXX_EXCEPTIONS catch(const Base::Exception& e) // catch the FreeCAD exceptions { - PyObject *edict = e.getPyDict(); + PyObject *edict = e.getPyObject(); e.ReportException(); PyErr_SetObject(Base::BaseExceptionFreeCADError, edict); @@ -788,7 +788,7 @@ class @self.export.Namespace@Export @self.export.Name@ : public @self.export.Fat #else // DONT_CATCH_CXX_EXCEPTIONS catch(const Base::Exception& e) // catch the FreeCAD exceptions { - PyObject *edict = e.getPyDict(); + PyObject *edict = e.getPyObject(); e.ReportException(); PyErr_SetObject(Base::BaseExceptionFreeCADError, edict);