Prefer to use BaseClass's isDerivedFrom<T> over non template or Base::Type's
Regex based changes, manually verified
This commit is contained in:
@@ -178,7 +178,7 @@ private:
|
||||
if (PyObject_TypeCheck(pObj, &(App::DocumentObjectPy::Type))) {
|
||||
App::DocumentObject* obj =
|
||||
static_cast<App::DocumentObjectPy*>(pObj)->getDocumentObjectPtr();
|
||||
if (obj->getTypeId().isDerivedFrom(Base::Type::fromName("Path::Feature"))) {
|
||||
if (obj->isDerivedFrom<Path::Feature>()) {
|
||||
const Path::Toolpath& path = static_cast<Path::Feature*>(obj)->Path.getValue();
|
||||
std::string gcode = path.toGCode();
|
||||
Base::ofstream ofile(file);
|
||||
|
||||
@@ -82,7 +82,7 @@ App::DocumentObjectExecReturn* FeatureArea::execute()
|
||||
}
|
||||
|
||||
for (std::vector<App::DocumentObject*>::iterator it = links.begin(); it != links.end(); ++it) {
|
||||
if (!(*it && (*it)->isDerivedFrom(Part::Feature::getClassTypeId()))) {
|
||||
if (!(*it && (*it)->isDerivedFrom<Part::Feature>())) {
|
||||
return new App::DocumentObjectExecReturn(
|
||||
"Linked object is not a Part object (has no Shape).");
|
||||
}
|
||||
@@ -202,7 +202,7 @@ std::list<TopoDS_Shape> FeatureAreaView::getShapes()
|
||||
if (!pObj) {
|
||||
return shapes;
|
||||
}
|
||||
if (!pObj->isDerivedFrom(FeatureArea::getClassTypeId())) {
|
||||
if (!pObj->isDerivedFrom<FeatureArea>()) {
|
||||
return shapes;
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ App::DocumentObjectExecReturn* FeatureAreaView::execute()
|
||||
return new App::DocumentObjectExecReturn("No shape linked");
|
||||
}
|
||||
|
||||
if (!pObj->isDerivedFrom(FeatureArea::getClassTypeId())) {
|
||||
if (!pObj->isDerivedFrom<FeatureArea>()) {
|
||||
return new App::DocumentObjectExecReturn("Linked object is not a FeatureArea");
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ App::DocumentObjectExecReturn* FeatureShape::execute()
|
||||
|
||||
std::list<TopoDS_Shape> shapes;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = links.begin(); it != links.end(); ++it) {
|
||||
if (!(*it && (*it)->isDerivedFrom(Part::Feature::getClassTypeId()))) {
|
||||
if (!(*it && (*it)->isDerivedFrom<Part::Feature>())) {
|
||||
continue;
|
||||
}
|
||||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(*it)->Shape.getShape().getShape();
|
||||
|
||||
@@ -132,7 +132,7 @@ void PropertyPath::RestoreDocFile(Base::Reader& reader)
|
||||
{
|
||||
App::PropertyContainer* container = getContainer();
|
||||
App::DocumentObject* obj = nullptr;
|
||||
if (container->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
if (container->isDerivedFrom<App::DocumentObject>()) {
|
||||
obj = static_cast<App::DocumentObject*>(container);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user