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

Side by Side Diff: swig/Lib/typemaps/std_strings.swg

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, 11 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/typemaps/std_string.swg ('k') | swig/Lib/typemaps/std_wstring.swg » ('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
2 /* defining the String asptr/from methods */
3
4 %define %std_string_asptr(String, Char, SWIG_AsCharPtrAndSize, Frag)
5 %fragment(SWIG_AsPtr_frag(String),"header",fragment=Frag) {
6 SWIGINTERN int
7 SWIG_AsPtr_dec(String)(SWIG_Object obj, String **val)
8 {
9 Char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
10 if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
11 if (buf) {
12 if (val) *val = new String(buf, size - 1);
13 if (alloc == SWIG_NEWOBJ) %delete_array(buf);
14 return SWIG_NEWOBJ;
15 } else {
16 if (val) *val = 0;
17 return SWIG_OLDOBJ;
18 }
19 } else {
20 static int init = 0;
21 static swig_type_info* descriptor = 0;
22 if (!init) {
23 descriptor = SWIG_TypeQuery(#String " *");
24 init = 1;
25 }
26 if (descriptor) {
27 String *vptr;
28 int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
29 if (SWIG_IsOK(res) && val) *val = vptr;
30 return res;
31 }
32 }
33 return SWIG_ERROR;
34 }
35 }
36 %enddef
37
38 %define %std_string_from(String, SWIG_FromCharPtrAndSize, Frag)
39 %fragment(SWIG_From_frag(String),"header",fragment=Frag) {
40 SWIGINTERNINLINE SWIG_Object
41 SWIG_From_dec(String)(const String& s)
42 {
43 if (s.size()) {
44 return SWIG_FromCharPtrAndSize(s.data(), s.size());
45 } else {
46 return SWIG_FromCharPtrAndSize(s.c_str(), 0);
47 }
48 }
49 }
50 %enddef
51
52 %define %std_string_asval(String)
53 %fragment(SWIG_AsVal_frag(String),"header", fragment=SWIG_AsPtr_frag(String)) {
54 SWIGINTERN int
55 SWIG_AsVal_dec(String)(SWIG_Object obj, String *val)
56 {
57 String* v = (String *) 0;
58 int res = SWIG_AsPtr(String)(obj, &v);
59 if (!SWIG_IsOK(res)) return res;
60 if (v) {
61 if (val) *val = *v;
62 if (SWIG_IsNewObj(res)) {
63 %delete(v);
64 res = SWIG_DelNewMask(res);
65 }
66 return res;
67 }
68 return SWIG_ERROR;
69 }
70 }
71 %enddef
72
73
74 %define %typemaps_std_string(String, Char, AsPtrMethod, FromMethod, CheckCode)
75
76 %std_string_asptr(String, Char, AsPtrMethod, #AsPtrMethod)
77 %std_string_asval(String)
78 %std_string_from(String, FromMethod, #FromMethod)
79
80 %typemaps_asptrfromn(%arg(CheckCode), String);
81
82 %enddef
OLDNEW
« no previous file with comments | « swig/Lib/typemaps/std_string.swg ('k') | swig/Lib/typemaps/std_wstring.swg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698