diff options
Diffstat (limited to 'swig')
| -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) | |||
| 4 | 4 | ||
| 5 | INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ) | 5 | INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ) |
| 6 | 6 | ||
| 7 | SET_SOURCE_FILES_PROPERTIES(plist.i PROPERTIES CPLUSPLUS ON) | ||
| 7 | SWIG_ADD_MODULE( PList python plist.i ) | 8 | SWIG_ADD_MODULE( PList python plist.i ) |
| 8 | SWIG_LINK_LIBRARIES( PList plist ${PYTHON_LIBRARIES} ) | 9 | SWIG_LINK_LIBRARIES( PList plist plist++ ${PYTHON_LIBRARIES} ) |
| 9 | 10 | ||
| 10 | EXEC_PROGRAM("${PYTHON_EXECUTABLE}" | 11 | EXEC_PROGRAM("${PYTHON_EXECUTABLE}" |
| 11 | ARGS "-c 'try:\n import distutils.sysconfig; print distutils.sysconfig.get_python_lib()\nexcept: pass\n'" | 12 | 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 @@ | |||
| 4 | %{ | 4 | %{ |
| 5 | /* Includes the header in the wrapper code */ | 5 | /* Includes the header in the wrapper code */ |
| 6 | #include <plist/plist.h> | 6 | #include <plist/plist.h> |
| 7 | #include <plist/plist++.h> | ||
| 8 | |||
| 7 | typedef struct { | 9 | typedef struct { |
| 8 | plist_t node; | 10 | plist_t node; |
| 9 | char should_keep_plist; | 11 | char should_keep_plist; |
| @@ -21,6 +23,34 @@ PListNode *allocate_plist_wrapper(plist_t plist, char should_keep_plist) { | |||
| 21 | } | 23 | } |
| 22 | %} | 24 | %} |
| 23 | 25 | ||
| 26 | %include "stl.i" | ||
| 27 | |||
| 28 | %rename(__assign__) *::operator=; | ||
| 29 | %rename(__getitem__) *::operator[]; | ||
| 30 | |||
| 31 | %ignore Boolean(plist_t); | ||
| 32 | %ignore Integer(plist_t); | ||
| 33 | %ignore Real(plist_t); | ||
| 34 | %ignore String(plist_t); | ||
| 35 | %ignore Data(plist_t); | ||
| 36 | %ignore Date(plist_t); | ||
| 37 | %ignore Array(plist_t); | ||
| 38 | %ignore Dictionary(plist_t); | ||
| 39 | |||
| 40 | %include <plist/Node.h> | ||
| 41 | %include <plist/Boolean.h> | ||
| 42 | %include <plist/Integer.h> | ||
| 43 | %include <plist/Real.h> | ||
| 44 | %include <plist/String.h> | ||
| 45 | %include <plist/Data.h> | ||
| 46 | %include <plist/Date.h> | ||
| 47 | %include <plist/Structure.h> | ||
| 48 | %include <plist/Array.h> | ||
| 49 | %include <plist/Dictionary.h> | ||
| 50 | %include <plist/Utils.h> | ||
| 51 | |||
| 52 | //deprecated wrapper below | ||
| 53 | |||
| 24 | %include "stdint.i" | 54 | %include "stdint.i" |
| 25 | %include "cstring.i" | 55 | %include "cstring.i" |
| 26 | 56 | ||
| @@ -189,9 +219,9 @@ typedef struct { | |||
| 189 | } | 219 | } |
| 190 | 220 | ||
| 191 | char as_bool() { | 221 | char as_bool() { |
| 192 | char b; | 222 | uint8_t b; |
| 193 | plist_get_bool_val($self->node, &b); | 223 | plist_get_bool_val($self->node, &b); |
| 194 | return b; | 224 | return (char)b; |
| 195 | } | 225 | } |
| 196 | 226 | ||
| 197 | uint64_t as_uint() { | 227 | uint64_t as_uint() { |
