MCPcopy Create free account
hub / github.com/chokkan/crfsuite / SWIG_AsPtr_std_string

Function SWIG_AsPtr_std_string

swig/python/export_wrap.cpp:5193–5221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5191
5192
5193SWIGINTERN int
5194SWIG_AsPtr_std_string (PyObject * obj, std::string **val)
5195{
5196 char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
5197 if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
5198 if (buf) {
5199 if (val) *val = new std::string(buf, size - 1);
5200 if (alloc == SWIG_NEWOBJ) delete[] buf;
5201 return SWIG_NEWOBJ;
5202 } else {
5203 if (val) *val = 0;
5204 return SWIG_OLDOBJ;
5205 }
5206 } else {
5207 static int init = 0;
5208 static swig_type_info* descriptor = 0;
5209 if (!init) {
5210 descriptor = SWIG_TypeQuery("std::string" " *");
5211 init = 1;
5212 }
5213 if (descriptor) {
5214 std::string *vptr;
5215 int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
5216 if (SWIG_IsOK(res) && val) *val = vptr;
5217 return res;
5218 }
5219 }
5220 return SWIG_ERROR;
5221}
5222
5223
5224SWIGINTERN int

Calls

no outgoing calls

Tested by

no test coverage detected