diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index 46b47228..c2c4c62c 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -131,7 +131,7 @@ using namespace Hurricane; // x-----------------------------------------------------------------x - char* ConverterState::ObjectType::_inheritStop + const char* ConverterState::ObjectType::_inheritStop = "comp"; ConverterState __cs = ConverterState (); int __objectOffset = offsetof ( PyPoint, _object ); @@ -200,11 +200,11 @@ using namespace Hurricane; // ------------------------------------------------------------------- // Method : "::ConverterState::addType ()" - void ConverterState::addType ( char* id + void ConverterState::addType ( const char* id , PyTypeObject* pyType - , char* name + , const char* name , bool isPythonType - , char* idBase ) { + , const char* idBase ) { for ( unsigned i=0 ; i < _types.size() ; i++ ) { if ( ! strcmp ( _types[i]->_id, id ) ) throw Error ( objectTypeRedefinition ); @@ -259,7 +259,7 @@ using namespace Hurricane; // ------------------------------------------------------------------- // Method : "::ConverterState::getObjectId ()" - char* ConverterState::getObjectId ( PyObject* object ) { + const char* ConverterState::getObjectId ( PyObject* object ) const { for ( unsigned i=0 ; i < _types.size() ; i++ ) { if ( ( ! strcmp ( _types[i]->_id, "function" ) ) && ( PyCallable_Check(object) ) ) return ( _types[i]->_id ); @@ -290,7 +290,7 @@ using namespace Hurricane; // ------------------------------------------------------------------- // Method : "::ConverterState::getObjectName ()" - char *ConverterState::getObjectName ( string id ) { + const char *ConverterState::getObjectName ( string id ) const { for ( unsigned i=0 ; i < _types.size() ; i++ ) { if ( ! strcmp ( id.c_str(), _types[i]->_id ) ) return ( _types[i]->_name ); } @@ -303,7 +303,7 @@ using namespace Hurricane; // ------------------------------------------------------------------- // Method : "::ConverterState::init ()" - void ConverterState::init ( char* function, char* inheritStop ) { + void ConverterState::init ( const char* function, const char* inheritStop ) { _objectIds = ""; setFunction ( function ); ObjectType::_inheritStop = inheritStop; diff --git a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h index 693593d6..3ee74e35 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h @@ -82,11 +82,11 @@ using namespace std; public: struct ObjectType { - static char* _inheritStop; + static const char* _inheritStop; char _id [11]; char _idBase[11]; PyTypeObject* _pyType; - char* _name; + const char* _name; bool _isPythonType; unsigned _index; @@ -99,7 +99,7 @@ using namespace std; typedef vector ObjectTypeVector; protected: string _objectIds; - protected: char* _function; + protected: const char* _function; protected: ObjectTypeVector _types; @@ -110,17 +110,17 @@ using namespace std; public: ~ConverterState (); public: ObjectType* getObject ( char* id ); - public: char* getObjectId ( PyObject* object ); - public: char* getObjectName ( string id ); + public: const char* getObjectId ( PyObject* object ) const; + public: const char* getObjectName ( string id ) const; public: string getObjectIds () const { return ( _objectIds ); }; - public: char* getFunction () const { return ( _function ); }; + public: const char* getFunction () const { return ( _function ); }; public: int getSize () const { return ( _objectIds.size() ); }; public: const ObjectTypeVector& getTypes () const { return ( _types ); }; public: void addObject ( PyObject* object ) { _objectIds += getObjectId ( object ); }; public: void addId ( char* id ) { _objectIds += ":"; _objectIds += id; }; - public: void setFunction ( char* function ) { _function = function; }; - public: void init ( char* function, char* inheritStop="comp" ); - public: void addType ( char* id, PyTypeObject* pyType, char* name, bool isPythonType, char* idBase="" ); + public: void setFunction ( const char* function ) { _function = function; }; + public: void init ( const char* function, const char* inheritStop="comp" ); + public: void addType ( const char* id, PyTypeObject* pyType, const char* name, bool isPythonType, const char* idBase="" ); public: static string getObjectType ( string objectsTypes, unsigned n ); }; @@ -131,9 +131,9 @@ using namespace std; // Isobar Global Functions. int Converter ( PyObject* object, void** pArg ); - bool ParseOneArg ( char* function, PyObject* args, string format, PyObject** arg ); - bool ParseTwoArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1 ); - bool ParseThreeArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1, PyObject** arg2 ); + bool ParseOneArg ( const char* function, PyObject* args, string format, PyObject** arg ); + bool ParseTwoArg ( const char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1 ); + bool ParseThreeArg ( const char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1, PyObject** arg2 );