diff options
author | Jonathan Beck | 2009-10-16 22:32:15 +0200 |
---|---|---|
committer | Jonathan Beck | 2009-10-16 22:32:15 +0200 |
commit | 0f69774fcfe32ac2a8dacefbea61e84d0a26a012 (patch) | |
tree | 5da7e0d661b9126e5bd0f98d592a5665a36461e0 | |
parent | 7ba9a5437e49868ca7a7cc2f4d006509308b1ab4 (diff) | |
download | libplist-0f69774fcfe32ac2a8dacefbea61e84d0a26a012.tar.gz libplist-0f69774fcfe32ac2a8dacefbea61e84d0a26a012.tar.bz2 |
Change python binding to be based on libplist++ object model.
Deprecate old binding.
-rw-r--r-- | swig/CMakeLists.txt | 3 | ||||
-rw-r--r-- | swig/plist.i | 34 |
2 files changed, 34 insertions, 3 deletions
diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt index f79b3dc..81db20a 100644 --- a/swig/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -4,8 +4,9 @@ SET(CMAKE_SWIG_FLAGS -Werror -Wall -modern) INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ) +SET_SOURCE_FILES_PROPERTIES(plist.i PROPERTIES CPLUSPLUS ON) SWIG_ADD_MODULE( PList python plist.i ) -SWIG_LINK_LIBRARIES( PList plist ${PYTHON_LIBRARIES} ) +SWIG_LINK_LIBRARIES( PList plist plist++ ${PYTHON_LIBRARIES} ) EXEC_PROGRAM("${PYTHON_EXECUTABLE}" ARGS "-c 'try:\n import distutils.sysconfig; print distutils.sysconfig.get_python_lib()\nexcept: pass\n'" diff --git a/swig/plist.i b/swig/plist.i index dd0121d..1ab35b5 100644 --- a/swig/plist.i +++ b/swig/plist.i @@ -4,6 +4,8 @@ %{ /* Includes the header in the wrapper code */ #include <plist/plist.h> + #include <plist/plist++.h> + typedef struct { plist_t node; char should_keep_plist; @@ -21,6 +23,34 @@ PListNode *allocate_plist_wrapper(plist_t plist, char should_keep_plist) { } %} +%include "stl.i" + +%rename(__assign__) *::operator=; +%rename(__getitem__) *::operator[]; + +%ignore Boolean(plist_t); +%ignore Integer(plist_t); +%ignore Real(plist_t); +%ignore String(plist_t); +%ignore Data(plist_t); +%ignore Date(plist_t); +%ignore Array(plist_t); +%ignore Dictionary(plist_t); + +%include <plist/Node.h> +%include <plist/Boolean.h> +%include <plist/Integer.h> +%include <plist/Real.h> +%include <plist/String.h> +%include <plist/Data.h> +%include <plist/Date.h> +%include <plist/Structure.h> +%include <plist/Array.h> +%include <plist/Dictionary.h> +%include <plist/Utils.h> + +//deprecated wrapper below + %include "stdint.i" %include "cstring.i" @@ -189,9 +219,9 @@ typedef struct { } char as_bool() { - char b; + uint8_t b; plist_get_bool_val($self->node, &b); - return b; + return (char)b; } uint64_t as_uint() { |