1 #if !defined(SWIG_STD_STRING)
2 #define SWIG_STD_BASIC_STRING
4 %include <rubycontainer.swg>
6 #define %swig_basic_string(Type...) %swig_sequence_methods_val(Type)
9 %traits_swigtype(std::basic_string<char>);
10 %fragment(SWIG_Traits_frag(std::basic_string<char>));
13 %fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
14 fragment="SWIG_AsCharPtrAndSize") {
16 SWIG_AsPtr(std::basic_string<char>)(VALUE obj, std::string **val)
18 static swig_type_info* string_info =
19 SWIG_TypeQuery("std::basic_string<char> *");
21 if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
25 char* buf = 0 ; size_t size = 0; int alloc = 0;
26 if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
28 if (val) *val = new std::string(buf, size - 1);
29 if (alloc == SWIG_NEWOBJ) %delete_array(buf);
34 rb_raise( rb_eTypeError, "a string is expected");
41 %fragment(SWIG_From_frag(std::basic_string<char>),"header",
42 fragment="SWIG_FromCharPtrAndSize") {
43 SWIGINTERNINLINE VALUE
44 SWIG_From(std::basic_string<char>)(const std::string& s)
46 return SWIG_FromCharPtrAndSize(s.data(), s.size());
50 %include <std/std_basic_string.i>
51 %typemaps_asptrfromn(%checkcode(STRING), std::basic_string<char>);
56 #if !defined(SWIG_STD_WSTRING)
58 %fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
59 fragment="SWIG_AsWCharPtrAndSize") {
61 SWIG_AsPtr(std::basic_string<wchar_t>)(VALUE obj, std::wstring **val)
63 static swig_type_info* string_info =
64 SWIG_TypeQuery("std::basic_string<wchar_t> *");
66 if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
70 wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
71 if (SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
73 if (val) *val = new std::wstring(buf, size - 1);
74 if (alloc == SWIG_NEWOBJ) %delete_array(buf);
79 rb_raise( rb_eTypeError, "a string is expected");
86 %fragment(SWIG_From_frag(std::basic_string<wchar_t>),"header",
87 fragment="SWIG_FromWCharPtrAndSize") {
88 SWIGINTERNINLINE VALUE
89 SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s)
91 return SWIG_FromWCharPtrAndSize(s.data(), s.size());
95 %typemaps_asptrfromn(%checkcode(UNISTRING), std::basic_string<wchar_t>);