1 #if !defined(SWIG_STD_STRING)
2 #define SWIG_STD_BASIC_STRING
3 #define SWIG_STD_MODERN_STL
5 %include <octcontainer.swg>
7 #define %swig_basic_string(Type...) %swig_sequence_methods_val(Type)
10 %fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
11 fragment="SWIG_AsCharPtrAndSize") {
13 SWIG_AsPtr(std::basic_string<char>)(octave_value obj, std::string **val)
15 if (obj.is_string()) {
17 *val = new std::string(obj.string_value());
21 error("a string is expected");
26 %fragment(SWIG_From_frag(std::basic_string<char>),"header",
27 fragment="SWIG_FromCharPtrAndSize") {
28 SWIGINTERNINLINE octave_value
29 SWIG_From(std::basic_string<char>)(const std::string& s)
31 return SWIG_FromCharPtrAndSize(s.data(), s.size());
35 %include <std/std_basic_string.i>
36 %typemaps_asptrfromn(%checkcode(STRING), std::basic_string<char>);
41 #if !defined(SWIG_STD_WSTRING)
43 %fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
44 fragment="SWIG_AsWCharPtrAndSize") {
46 SWIG_AsPtr(std::basic_string<wchar_t>)(PyObject* obj, std::wstring **val)
48 static swig_type_info* string_info =
49 SWIG_TypeQuery("std::basic_string<wchar_t> *");
51 if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
56 wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
57 if (SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
59 if (val) *val = new std::wstring(buf, size - 1);
60 if (alloc == SWIG_NEWOBJ) %delete_array(buf);
67 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
68 PyErr_SetString(PyExc_TypeError,"a wstring is expected");
69 SWIG_PYTHON_THREAD_END_BLOCK;
76 %fragment(SWIG_From_frag(std::basic_string<wchar_t>),"header",
77 fragment="SWIG_FromWCharPtrAndSize") {
78 SWIGINTERNINLINE PyObject*
79 SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s)
81 return SWIG_FromWCharPtrAndSize(s.data(), s.size());
85 %typemaps_asptrfromn(%checkcode(UNISTRING), std::basic_string<wchar_t>);