diff options
author | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-05-16 17:05:15 +0400 |
---|---|---|
committer | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-05-16 17:05:15 +0400 |
commit | 2fd6e728513f46e1f313667dfcf6b3d6e09cad39 (patch) | |
tree | 97306352111268430c9c5bcd75c1638be098cc0d /source/gameengine/Expressions/Value.h | |
parent | 9827bf0cd7c94273e147caae6bb254cf70aed221 (diff) |
Changed Python _getattr/_setattr methods to use const STR_String& instead of char* - makes using these methods much nicer.
Diffstat (limited to 'source/gameengine/Expressions/Value.h')
-rw-r--r-- | source/gameengine/Expressions/Value.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h index 527dfa85d39..4656e2ca5ac 100644 --- a/source/gameengine/Expressions/Value.h +++ b/source/gameengine/Expressions/Value.h @@ -200,6 +200,20 @@ public: static char method_name##_doc[]; \ /* The line above should remain empty */ +/** + * Method table macro (with doc) + */ +#define KX_PYMETHODTABLE(class_name, method_name) \ + {#method_name , (PyCFunction) class_name::sPy##method_name, METH_VARARGS, class_name::method_name##_doc} + +/** + * Function implementation macro + */ +#define KX_PYMETHODDEF_DOC(class_name, method_name, doc_string) \ +char class_name::method_name##_doc[] = doc_string; \ +PyObject* class_name::Py##method_name(PyObject* self, PyObject* args, PyObject* kwds) + + #ifndef NO_EXP_PYTHON_EMBEDDING #include "PyObjectPlus.h" @@ -239,7 +253,7 @@ public: - PyObject* _getattr(char* attr); + virtual PyObject* _getattr(const STR_String& attr); void SpecialRelease() { @@ -266,7 +280,7 @@ public: virtual CValue* ConvertPythonToValue(PyObject* pyobj); - int _setattr(char* attr,PyObject* value); + virtual int _setattr(const STR_String& attr,PyObject* value); KX_PYMETHOD(CValue,GetName); |