Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: swig/Lib/python/std_basic_string.i

Issue 553095: Checkin swig binaries for win, linux and Mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « swig/Lib/python/std_alloc.i ('k') | swig/Lib/python/std_carray.i » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #if !defined(SWIG_STD_STRING)
2 #define SWIG_STD_BASIC_STRING
3
4 %include <pycontainer.swg>
5
6 #define %swig_basic_string(Type...) %swig_sequence_methods_val(Type)
7
8
9 %fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
10 fragment="SWIG_AsCharPtrAndSize") {
11 SWIGINTERN int
12 SWIG_AsPtr(std::basic_string<char>)(PyObject* obj, std::string **val)
13 {
14 static swig_type_info* string_info =
15 SWIG_TypeQuery("std::basic_string<char> *");
16 std::string *vptr;
17 if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
18 if (val) *val = vptr;
19 return SWIG_OLDOBJ;
20 } else {
21 PyErr_Clear();
22 char* buf = 0 ; size_t size = 0; int alloc = 0;
23 if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
24 if (buf) {
25 if (val) *val = new std::string(buf, size - 1);
26 if (alloc == SWIG_NEWOBJ) %delete_array(buf);
27 return SWIG_NEWOBJ;
28 }
29 } else {
30 PyErr_Clear();
31 }
32 if (val) {
33 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
34 PyErr_SetString(PyExc_TypeError,"a string is expected");
35 SWIG_PYTHON_THREAD_END_BLOCK;
36 }
37 return 0;
38 }
39 }
40 }
41
42 %fragment(SWIG_From_frag(std::basic_string<char>),"header",
43 fragment="SWIG_FromCharPtrAndSize") {
44 SWIGINTERNINLINE PyObject*
45 SWIG_From(std::basic_string<char>)(const std::string& s)
46 {
47 return SWIG_FromCharPtrAndSize(s.data(), s.size());
48 }
49 }
50
51 %include <std/std_basic_string.i>
52 %typemaps_asptrfromn(%checkcode(STRING), std::basic_string<char>);
53
54 #endif
55
56
57 #if !defined(SWIG_STD_WSTRING)
58
59 %fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
60 fragment="SWIG_AsWCharPtrAndSize") {
61 SWIGINTERN int
62 SWIG_AsPtr(std::basic_string<wchar_t>)(PyObject* obj, std::wstring **val)
63 {
64 static swig_type_info* string_info =
65 SWIG_TypeQuery("std::basic_string<wchar_t> *");
66 std::wstring *vptr;
67 if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
68 if (val) *val = vptr;
69 return SWIG_OLDOBJ;
70 } else {
71 PyErr_Clear();
72 wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
73 if (SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
74 if (buf) {
75 if (val) *val = new std::wstring(buf, size - 1);
76 if (alloc == SWIG_NEWOBJ) %delete_array(buf);
77 return SWIG_NEWOBJ;
78 }
79 } else {
80 PyErr_Clear();
81 }
82 if (val) {
83 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
84 PyErr_SetString(PyExc_TypeError,"a wstring is expected");
85 SWIG_PYTHON_THREAD_END_BLOCK;
86 }
87 return 0;
88 }
89 }
90 }
91
92 %fragment(SWIG_From_frag(std::basic_string<wchar_t>),"header",
93 fragment="SWIG_FromWCharPtrAndSize") {
94 SWIGINTERNINLINE PyObject*
95 SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s)
96 {
97 return SWIG_FromWCharPtrAndSize(s.data(), s.size());
98 }
99 }
100
101 %typemaps_asptrfromn(%checkcode(UNISTRING), std::basic_string<wchar_t>);
102
103 #endif
OLDNEW
« no previous file with comments | « swig/Lib/python/std_alloc.i ('k') | swig/Lib/python/std_carray.i » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698