diff options
| author | 2011-09-26 17:17:22 +0200 | |
|---|---|---|
| committer | 2011-09-26 17:17:22 +0200 | |
| commit | bf1dcaecc3e7c4a123059ff5347bc5180835dbad (patch) | |
| tree | b8d539cdba59e6938743758b20593a1511cf522e /cython/plist.pyx | |
| parent | 89900d6decbfe805720a9cbce65655ec31086f94 (diff) | |
| download | libplist-bf1dcaecc3e7c4a123059ff5347bc5180835dbad.tar.gz libplist-bf1dcaecc3e7c4a123059ff5347bc5180835dbad.tar.bz2 | |
Changed bool to bint in Cython functions. Added some more type qualifiers.
Diffstat (limited to 'cython/plist.pyx')
| -rw-r--r-- | cython/plist.pyx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/cython/plist.pyx b/cython/plist.pyx index c636f7d..aa4f0d8 100644 --- a/cython/plist.pyx +++ b/cython/plist.pyx | |||
| @@ -171,7 +171,7 @@ cdef class Bool(Node): | |||
| 171 | plist_get_bool_val(self._c_node, &value) | 171 | plist_get_bool_val(self._c_node, &value) |
| 172 | return bool(value) | 172 | return bool(value) |
| 173 | 173 | ||
| 174 | cdef Bool Bool_factory(plist_t c_node, bool managed=True): | 174 | cdef Bool Bool_factory(plist_t c_node, bint managed=True): |
| 175 | cdef Bool instance = Bool.__new__(Bool) | 175 | cdef Bool instance = Bool.__new__(Bool) |
| 176 | instance._c_managed = managed | 176 | instance._c_managed = managed |
| 177 | instance._c_node = c_node | 177 | instance._c_node = c_node |
| @@ -217,7 +217,7 @@ cdef class Integer(Node): | |||
| 217 | plist_get_uint_val(self._c_node, &value) | 217 | plist_get_uint_val(self._c_node, &value) |
| 218 | return value | 218 | return value |
| 219 | 219 | ||
| 220 | cdef Integer Integer_factory(plist_t c_node, bool managed=True): | 220 | cdef Integer Integer_factory(plist_t c_node, bint managed=True): |
| 221 | cdef Integer instance = Integer.__new__(Integer) | 221 | cdef Integer instance = Integer.__new__(Integer) |
| 222 | instance._c_managed = managed | 222 | instance._c_managed = managed |
| 223 | instance._c_node = c_node | 223 | instance._c_node = c_node |
| @@ -263,7 +263,7 @@ cdef class Real(Node): | |||
| 263 | plist_get_real_val(self._c_node, &value) | 263 | plist_get_real_val(self._c_node, &value) |
| 264 | return value | 264 | return value |
| 265 | 265 | ||
| 266 | cdef Real Real_factory(plist_t c_node, bool managed=True): | 266 | cdef Real Real_factory(plist_t c_node, bint managed=True): |
| 267 | cdef Real instance = Real.__new__(Real) | 267 | cdef Real instance = Real.__new__(Real) |
| 268 | instance._c_managed = managed | 268 | instance._c_managed = managed |
| 269 | instance._c_node = c_node | 269 | instance._c_node = c_node |
| @@ -285,7 +285,7 @@ cdef class String(Node): | |||
| 285 | value.decode('ascii') # trial decode | 285 | value.decode('ascii') # trial decode |
| 286 | utf8_data = value.decode('ascii') | 286 | utf8_data = value.decode('ascii') |
| 287 | else: | 287 | else: |
| 288 | raise ValueError("requires text input, got %s" % type(value)) | 288 | raise ValueError("Requires unicode input, got %s" % type(value)) |
| 289 | c_utf8_data = utf8_data | 289 | c_utf8_data = utf8_data |
| 290 | self._c_node = plist_new_string(c_utf8_data) | 290 | self._c_node = plist_new_string(c_utf8_data) |
| 291 | 291 | ||
| @@ -321,7 +321,7 @@ cdef class String(Node): | |||
| 321 | value.decode('ascii') # trial decode | 321 | value.decode('ascii') # trial decode |
| 322 | utf8_data = value.decode('ascii') | 322 | utf8_data = value.decode('ascii') |
| 323 | else: | 323 | else: |
| 324 | raise ValueError("requires text input, got %s" % type(value)) | 324 | raise ValueError("Requires unicode input, got %s" % type(value)) |
| 325 | c_utf8_data = utf8_data | 325 | c_utf8_data = utf8_data |
| 326 | plist_set_string_val(self._c_node, c_utf8_data) | 326 | plist_set_string_val(self._c_node, c_utf8_data) |
| 327 | 327 | ||
| @@ -334,7 +334,7 @@ cdef class String(Node): | |||
| 334 | finally: | 334 | finally: |
| 335 | stdlib.free(c_value) | 335 | stdlib.free(c_value) |
| 336 | 336 | ||
| 337 | cdef String String_factory(plist_t c_node, bool managed=True): | 337 | cdef String String_factory(plist_t c_node, bint managed=True): |
| 338 | cdef String instance = String.__new__(String) | 338 | cdef String instance = String.__new__(String) |
| 339 | instance._c_managed = managed | 339 | instance._c_managed = managed |
| 340 | instance._c_node = c_node | 340 | instance._c_node = c_node |
| @@ -386,7 +386,7 @@ cdef class Date(Node): | |||
| 386 | plist_get_date_val(self._c_node, &secs, &usecs) | 386 | plist_get_date_val(self._c_node, &secs, &usecs) |
| 387 | return ints_to_datetime(secs, usecs) | 387 | return ints_to_datetime(secs, usecs) |
| 388 | 388 | ||
| 389 | cpdef set_value(self, value): | 389 | cpdef set_value(self, object value): |
| 390 | cdef int32_t secs | 390 | cdef int32_t secs |
| 391 | cdef int32_t usecs | 391 | cdef int32_t usecs |
| 392 | if not check_datetime(value): | 392 | if not check_datetime(value): |
| @@ -394,7 +394,7 @@ cdef class Date(Node): | |||
| 394 | datetime_to_ints(value, &secs, &usecs) | 394 | datetime_to_ints(value, &secs, &usecs) |
| 395 | plist_set_date_val(self._c_node, secs, usecs) | 395 | plist_set_date_val(self._c_node, secs, usecs) |
| 396 | 396 | ||
| 397 | cdef Date Date_factory(plist_t c_node, bool managed=True): | 397 | cdef Date Date_factory(plist_t c_node, bint managed=True): |
| 398 | cdef Date instance = Date.__new__(Date) | 398 | cdef Date instance = Date.__new__(Date) |
| 399 | instance._c_managed = managed | 399 | instance._c_managed = managed |
| 400 | instance._c_node = c_node | 400 | instance._c_node = c_node |
| @@ -440,13 +440,13 @@ cdef class Data(Node): | |||
| 440 | cpdef set_value(self, bytes value): | 440 | cpdef set_value(self, bytes value): |
| 441 | plist_set_data_val(self._c_node, value, len(value)) | 441 | plist_set_data_val(self._c_node, value, len(value)) |
| 442 | 442 | ||
| 443 | cdef Data Data_factory(plist_t c_node, bool managed=True): | 443 | cdef Data Data_factory(plist_t c_node, bint managed=True): |
| 444 | cdef Data instance = Data.__new__(Data) | 444 | cdef Data instance = Data.__new__(Data) |
| 445 | instance._c_managed = managed | 445 | instance._c_managed = managed |
| 446 | instance._c_node = c_node | 446 | instance._c_node = c_node |
| 447 | return instance | 447 | return instance |
| 448 | 448 | ||
| 449 | cdef plist_t create_dict_plist(value=None): | 449 | cdef plist_t create_dict_plist(object value=None): |
| 450 | cdef plist_t node = NULL | 450 | cdef plist_t node = NULL |
| 451 | cdef plist_t c_node = NULL | 451 | cdef plist_t c_node = NULL |
| 452 | node = plist_new_dict() | 452 | node = plist_new_dict() |
| @@ -565,14 +565,14 @@ cdef class Dict(Node): | |||
| 565 | python_dict.PyDict_DelItem(self._map, key) | 565 | python_dict.PyDict_DelItem(self._map, key) |
| 566 | plist_dict_remove_item(self._c_node, key) | 566 | plist_dict_remove_item(self._c_node, key) |
| 567 | 567 | ||
| 568 | cdef Dict Dict_factory(plist_t c_node, bool managed=True): | 568 | cdef Dict Dict_factory(plist_t c_node, bint managed=True): |
| 569 | cdef Dict instance = Dict.__new__(Dict) | 569 | cdef Dict instance = Dict.__new__(Dict) |
| 570 | instance._c_managed = managed | 570 | instance._c_managed = managed |
| 571 | instance._c_node = c_node | 571 | instance._c_node = c_node |
| 572 | instance._init() | 572 | instance._init() |
| 573 | return instance | 573 | return instance |
| 574 | 574 | ||
| 575 | cdef plist_t create_array_plist(value=None): | 575 | cdef plist_t create_array_plist(object value=None): |
| 576 | cdef plist_t node = NULL | 576 | cdef plist_t node = NULL |
| 577 | cdef plist_t c_node = NULL | 577 | cdef plist_t c_node = NULL |
| 578 | node = plist_new_array() | 578 | node = plist_new_array() |
| @@ -666,7 +666,7 @@ cdef class Array(Node): | |||
| 666 | plist_array_append_item(self._c_node, n._c_node) | 666 | plist_array_append_item(self._c_node, n._c_node) |
| 667 | self._array.append(n) | 667 | self._array.append(n) |
| 668 | 668 | ||
| 669 | cdef Array Array_factory(plist_t c_node, bool managed=True): | 669 | cdef Array Array_factory(plist_t c_node, bint managed=True): |
| 670 | cdef Array instance = Array.__new__(Array) | 670 | cdef Array instance = Array.__new__(Array) |
| 671 | instance._c_managed = managed | 671 | instance._c_managed = managed |
| 672 | instance._c_node = c_node | 672 | instance._c_node = c_node |
| @@ -707,7 +707,7 @@ cdef plist_t native_to_plist_t(object native): | |||
| 707 | if check_datetime(native): | 707 | if check_datetime(native): |
| 708 | return create_date_plist(native) | 708 | return create_date_plist(native) |
| 709 | 709 | ||
| 710 | cdef object plist_t_to_node(plist_t c_plist, bool managed=True): | 710 | cdef object plist_t_to_node(plist_t c_plist, bint managed=True): |
| 711 | cdef plist_type t = plist_get_node_type(c_plist) | 711 | cdef plist_type t = plist_get_node_type(c_plist) |
| 712 | if t == PLIST_BOOLEAN: | 712 | if t == PLIST_BOOLEAN: |
| 713 | return Bool_factory(c_plist, managed) | 713 | return Bool_factory(c_plist, managed) |
