MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkPythonGetStringValue

Function vtkPythonGetStringValue

Wrapping/PythonCore/vtkPythonArgs.cxx:104–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104bool vtkPythonGetStringValue(PyObject* o, const char*& a, const char* exctext)
105{
106 if (PyBytes_Check(o))
107 {
108 a = PyBytes_AsString(o);
109 return true;
110 }
111 else if (PyByteArray_Check(o))
112 {
113 a = PyByteArray_AsString(o);
114 return true;
115 }
116 else if (PyUnicode_Check(o))
117 {
118 a = PyUnicode_AsUTF8AndSize(o, nullptr);
119 return true;
120 }
121
122 if (exctext)
123 {
124 PyErr_SetString(PyExc_TypeError, exctext);
125 }
126 return false;
127}
128
129inline bool vtkPythonGetStdStringValue(PyObject* o, std::string& a, const char* exctext)
130{

Callers 3

vtkPythonGetValueFunction · 0.85
vtkPythonGetFilePathFunction · 0.85
vtkPythonGetArrayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected