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
commit953fa08ba7e99b73342bb9a9c204175d33102ffc (patch)
treef7743baa2709ae07f7c90d792baed33637fb9fe3
parent750df6a1454f4fd6091c5a2437e3007f7942d78d (diff)
python-bindings: Equivalent string conv functions for const_char_ptr.
SVN revision: 71911
-rw-r--r--evas/evas.c_evas.pyx14
1 files changed, 14 insertions, 0 deletions
diff --git a/evas/evas.c_evas.pyx b/evas/evas.c_evas.pyx
index cefaa3d..b37a144 100644
--- a/evas/evas.c_evas.pyx
+++ b/evas/evas.c_evas.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 # when changing these, also change __init__.py! 62 # when changing these, also change __init__.py!
49 if evas_object_event_callbacks_len != EVAS_CALLBACK_LAST: 63 if evas_object_event_callbacks_len != EVAS_CALLBACK_LAST: