Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
1b12d348
Commit
1b12d348
authored
Mar 19, 2013
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cython: added PLIST_UID support
parent
ef734743
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
plist.pxd
cython/plist.pxd
+4
-0
plist.pyx
cython/plist.pyx
+51
-0
No files found.
cython/plist.pxd
View file @
1b12d348
...
...
@@ -21,6 +21,10 @@ cdef class Integer(Node):
cpdef set_value(self, object value)
cpdef uint64_t get_value(self)
cdef class Uid(Node):
cpdef set_value(self, object value)
cpdef uint64_t get_value(self)
cdef class Key(Node):
cpdef set_value(self, object value)
cpdef unicode get_value(self)
...
...
cython/plist.pyx
View file @
1b12d348
...
...
@@ -13,6 +13,7 @@ cdef extern from *:
PLIST_DATE,
PLIST_DATA,
PLIST_KEY,
PLIST_UID,
PLIST_NONE
plist_t plist_new_bool(uint8_t val)
...
...
@@ -35,6 +36,10 @@ cdef extern from *:
void plist_get_key_val(plist_t node, char **val)
void plist_set_key_val(plist_t node, char *val)
plist_t plist_new_uid(uint64_t val)
void plist_get_uid_val(plist_t node, uint64_t *val)
void plist_set_uid_val(plist_t node, uint64_t val)
plist_t plist_new_string(char *val)
void plist_get_string_val(plist_t node, char **val)
void plist_set_string_val(plist_t node, char *val)
...
...
@@ -264,6 +269,52 @@ cdef Real Real_factory(plist_t c_node, bint managed=True):
instance._c_node = c_node
return instance
cdef class Uid(Node):
def __cinit__(self, object value=None, *args, **kwargs):
if value is None:
self._c_node = plist_new_uid(0)
else:
self._c_node = plist_new_uid(int(value))
def __repr__(self):
cdef uint64_t i = self.get_value()
return '<Uid: %s>' % i
def __int__(self):
return self.get_value()
def __float__(self):
return float(self.get_value())
def __richcmp__(self, other, op):
cdef int i = self.get_value()
if op == 0:
return i < other
if op == 1:
return i <= other
if op == 2:
return i == other
if op == 3:
return i != other
if op == 4:
return i > other
if op == 5:
return i >= other
cpdef set_value(self, object value):
plist_set_uid_val(self._c_node, int(value))
cpdef uint64_t get_value(self):
cdef uint64_t value
plist_get_uid_val(self._c_node, &value)
return value
cdef Uid Uid_factory(plist_t c_node, bint managed=True):
cdef Uid instance = Uid.__new__(Uid)
instance._c_managed = managed
instance._c_node = c_node
return instance
from cpython cimport PY_MAJOR_VERSION
cdef class Key(Node):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment