Merged with recent changes from trunk.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@11187 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
da5ade3143
commit
8c74fa0f46
703 changed files with 21126 additions and 9266 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#if !defined(SWIG_STD_STRING)
|
||||
#define SWIG_STD_BASIC_STRING
|
||||
#define SWIG_STD_MODERN_STL
|
||||
|
||||
%include <octcontainer.swg>
|
||||
|
||||
|
|
@ -9,39 +10,22 @@
|
|||
%fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
|
||||
fragment="SWIG_AsCharPtrAndSize") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsPtr(std::basic_string<char>)(PyObject* obj, std::string **val)
|
||||
SWIG_AsPtr(std::basic_string<char>)(octave_value obj, std::string **val)
|
||||
{
|
||||
static swig_type_info* string_info =
|
||||
SWIG_TypeQuery("std::basic_string<char> *");
|
||||
std::string *vptr;
|
||||
if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
char* buf = 0 ; size_t size = 0; int alloc = 0;
|
||||
if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
|
||||
if (buf) {
|
||||
if (val) *val = new std::string(buf, size - 1);
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
}
|
||||
if (val) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_TypeError,"a string is expected");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
}
|
||||
return 0;
|
||||
if (obj.is_string()) {
|
||||
if (val)
|
||||
*val = new std::string(obj.string_value());
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
}
|
||||
if (val)
|
||||
error("a string is expected");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(std::basic_string<char>),"header",
|
||||
fragment="SWIG_FromCharPtrAndSize") {
|
||||
SWIGINTERNINLINE PyObject*
|
||||
SWIGINTERNINLINE octave_value
|
||||
SWIG_From(std::basic_string<char>)(const std::string& s)
|
||||
{
|
||||
return SWIG_FromCharPtrAndSize(s.data(), s.size());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue