MCPcopy Create free account
hub / github.com/OSGeo/gdal / GetString

Function GetString

gcore/gdalpython.cpp:885–902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

883/************************************************************************/
884
885CPLString GetString(PyObject *obj, bool bEmitError)
886{
887 PyObject *unicode = PyUnicode_AsUTF8String(obj);
888 if (PyErr_Occurred())
889 {
890 if (bEmitError)
891 {
892 CPLError(CE_Failure, CPLE_AppDefined, "%s",
893 GetPyExceptionString().c_str());
894 }
895 return CPLString();
896 }
897
898 const char *pszRet = PyBytes_AsString(unicode);
899 CPLString osRet = pszRet ? pszRet : "";
900 Py_DecRef(unicode);
901 return osRet;
902}
903
904/************************************************************************/
905/* GetPyExceptionString() */

Callers 9

GetPyExceptionStringFunction · 0.70
GetDictFunction · 0.70
GetStringResFunction · 0.70
GetNameMethod · 0.70
GetFIDColumnMethod · 0.70
layer_featureCountFunction · 0.70
TranslateToOGRFeatureMethod · 0.70
GetFieldsMethod · 0.70
GetGeomFieldsMethod · 0.70

Calls 4

CPLErrorFunction · 0.85
GetPyExceptionStringFunction · 0.85
CPLStringFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected