MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / isDerivedFrom

Method isDerivedFrom

src/Base/TypePyImp.cpp:100–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100PyObject* TypePy::isDerivedFrom(PyObject* args) const
101{
102 Base::Type type;
103
104 do {
105 const char* name {};
106 if (PyArg_ParseTuple(args, "s", &name)) {
107 type = Type::fromName(name);
108 break;
109 }
110
111 PyErr_Clear();
112 PyObject* py {};
113 if (PyArg_ParseTuple(args, "O!", &TypePy::Type, &py)) {
114 type = *static_cast<TypePy*>(py)->getBaseTypePtr();
115 break;
116 }
117
118 PyErr_SetString(PyExc_TypeError, "TypeId or str expected");
119 return nullptr;
120 } while (false);
121
122 bool val = (!type.isBad() && getBaseTypePtr()->isDerivedFrom(type));
123 return PyBool_FromLong(val ? 1 : 0);
124}
125
126PyObject* TypePy::getAllDerivedFrom(PyObject* args)
127{

Callers

nothing calls this directly

Calls 1

isBadMethod · 0.45

Tested by

no test coverage detected