summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2012-06-10 16:56:06 +0000
committerKai Huuhko <kai.huuhko@gmail.com>2012-06-10 16:56:06 +0000
commitd0a804db8d04cb5b72c683b49d5e453b75bb88ce (patch)
tree51258d6cd6cbf84014a7ff8221b9b19ab9027989
parentde37226d5ccb5cc37d227e1e9692b4389af49c21 (diff)
python-bindings: Equivalent string conv functions for const_char_ptr.
SVN revision: 71911
-rw-r--r--edje/edje.c_edje.pyx14
1 files changed, 14 insertions, 0 deletions
diff --git a/edje/edje.c_edje.pyx b/edje/edje.c_edje.pyx
index 18ef588..7e87f8f 100644
--- a/edje/edje.c_edje.pyx
+++ b/edje/edje.c_edje.pyx
@@ -33,6 +33,9 @@ cdef int PY_REFCOUNT(object o):
33cdef unicode _touni(char* s): 33cdef unicode _touni(char* s):
34 return s.decode('UTF-8', 'strict') 34 return s.decode('UTF-8', 'strict')
35 35
36cdef unicode _ctouni(const_char_ptr s):
37 return s.decode('UTF-8', 'strict')
38
36cdef char* _fruni(s): 39cdef char* _fruni(s):
37 cdef char* c_string 40 cdef char* c_string
38 if isinstance(s, unicode): 41 if isinstance(s, unicode):
@@ -44,6 +47,17 @@ cdef char* _fruni(s):
44 raise TypeError("Expected str or unicode object, got %s" % (type(s).__name__)) 47 raise TypeError("Expected str or unicode object, got %s" % (type(s).__name__))
45 return c_string 48 return c_string
46 49
50cdef const_char_ptr _cfruni(s):
51 cdef const_char_ptr c_string
52 if isinstance(s, unicode):
53 string = s.encode('UTF-8')
54 c_string = string
55 elif isinstance(s, str):
56 c_string = s
57 else:
58 raise TypeError("Expected str or unicode object, got %s" % (type(s).__name__))
59 return c_string
60
47def init(): 61def init():
48 cdef int r = edje_init() 62 cdef int r = edje_init()
49 63