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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « swig/Lib/typemaps/std_string.swg ('k') | swig/Lib/typemaps/std_wstring.swg » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: swig/Lib/typemaps/std_strings.swg
===================================================================
--- swig/Lib/typemaps/std_strings.swg (revision 0)
+++ swig/Lib/typemaps/std_strings.swg (revision 0)
@@ -0,0 +1,82 @@
+
+/* defining the String asptr/from methods */
+
+%define %std_string_asptr(String, Char, SWIG_AsCharPtrAndSize, Frag)
+%fragment(SWIG_AsPtr_frag(String),"header",fragment=Frag) {
+SWIGINTERN int
+SWIG_AsPtr_dec(String)(SWIG_Object obj, String **val)
+{
+ Char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
+ if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
+ if (buf) {
+ if (val) *val = new String(buf, size - 1);
+ if (alloc == SWIG_NEWOBJ) %delete_array(buf);
+ return SWIG_NEWOBJ;
+ } else {
+ if (val) *val = 0;
+ return SWIG_OLDOBJ;
+ }
+ } else {
+ static int init = 0;
+ static swig_type_info* descriptor = 0;
+ if (!init) {
+ descriptor = SWIG_TypeQuery(#String " *");
+ init = 1;
+ }
+ if (descriptor) {
+ String *vptr;
+ int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
+ if (SWIG_IsOK(res) && val) *val = vptr;
+ return res;
+ }
+ }
+ return SWIG_ERROR;
+}
+}
+%enddef
+
+%define %std_string_from(String, SWIG_FromCharPtrAndSize, Frag)
+%fragment(SWIG_From_frag(String),"header",fragment=Frag) {
+SWIGINTERNINLINE SWIG_Object
+SWIG_From_dec(String)(const String& s)
+{
+ if (s.size()) {
+ return SWIG_FromCharPtrAndSize(s.data(), s.size());
+ } else {
+ return SWIG_FromCharPtrAndSize(s.c_str(), 0);
+ }
+}
+}
+%enddef
+
+%define %std_string_asval(String)
+%fragment(SWIG_AsVal_frag(String),"header", fragment=SWIG_AsPtr_frag(String)) {
+SWIGINTERN int
+SWIG_AsVal_dec(String)(SWIG_Object obj, String *val)
+{
+ String* v = (String *) 0;
+ int res = SWIG_AsPtr(String)(obj, &v);
+ if (!SWIG_IsOK(res)) return res;
+ if (v) {
+ if (val) *val = *v;
+ if (SWIG_IsNewObj(res)) {
+ %delete(v);
+ res = SWIG_DelNewMask(res);
+ }
+ return res;
+ }
+ return SWIG_ERROR;
+}
+}
+%enddef
+
+
+%define %typemaps_std_string(String, Char, AsPtrMethod, FromMethod, CheckCode)
+
+%std_string_asptr(String, Char, AsPtrMethod, #AsPtrMethod)
+%std_string_asval(String)
+%std_string_from(String, FromMethod, #FromMethod)
+
+%typemaps_asptrfromn(%arg(CheckCode), String);
+
+%enddef
« 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