Prefer to use BaseClass's isDerivedFrom<T> over non template or Base::Type's

Regex based changes, manually verified
This commit is contained in:
Benjamin Nauck
2025-01-16 21:27:50 +01:00
parent 6a3eb2ab49
commit 6f535f19fb
166 changed files with 484 additions and 497 deletions

View File

@@ -137,10 +137,10 @@ TaskFeaturePick::TaskFeaturePick(std::vector<App::DocumentObject*>& objects,
if (*statusIt != invalidShape && datum) {
App::Origin* origin = dynamic_cast<App::Origin*>(datum->getLCS());
if (origin) {
if ((*objIt)->isDerivedFrom(App::Plane::getClassTypeId())) {
if ((*objIt)->isDerivedFrom<App::Plane>()) {
originVisStatus[origin].setFlag(Gui::DatumElement::Planes, true);
}
else if ((*objIt)->isDerivedFrom(App::Line::getClassTypeId())) {
else if ((*objIt)->isDerivedFrom<App::Line>()) {
originVisStatus[origin].setFlag(Gui::DatumElement::Axes, true);
}
}
@@ -346,8 +346,8 @@ TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool indepe
return copy;
}
if (independent
&& (obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId())
|| obj->isDerivedFrom(PartDesign::FeaturePrimitive::getClassTypeId()))) {
&& (obj->isDerivedFrom<Sketcher::SketchObject>()
|| obj->isDerivedFrom<PartDesign::FeaturePrimitive>())) {
// we do know that the created instance is a document object, as obj is one. But we do not
// know which exact type
@@ -387,7 +387,7 @@ TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool indepe
// we are a independent copy, therefore no external geometry was copied. WE therefore
// can delete all constraints
if (obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) {
if (obj->isDerivedFrom<Sketcher::SketchObject>()) {
static_cast<Sketcher::SketchObject*>(copy)->delConstraintsToExternal();
}
}
@@ -411,11 +411,11 @@ TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool indepe
Part::PropertyPartShape* shapeProp = nullptr;
// TODO Replace it with commands (2015-09-11, Fat-Zer)
if (obj->isDerivedFrom(Part::Datum::getClassTypeId())) {
if (obj->isDerivedFrom<Part::Datum>()) {
copy = App::GetApplication().getActiveDocument()->addObject(obj->getTypeId().getName(),
name.c_str());
assert(copy->isDerivedFrom(Part::Datum::getClassTypeId()));
assert(copy->isDerivedFrom<Part::Datum>());
// we need to reference the individual datums and make again datums. This is important
// as datum adjust their size dependent on the part size, hence simply copying the shape
@@ -451,7 +451,7 @@ TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool indepe
}
}
else if (obj->is<PartDesign::ShapeBinder>()
|| obj->isDerivedFrom(Part::Feature::getClassTypeId())) {
|| obj->isDerivedFrom<Part::Feature>()) {
copy = App::GetApplication().getActiveDocument()->addObject("PartDesign::ShapeBinder",
name.c_str());
@@ -463,8 +463,8 @@ TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool indepe
shapeProp = &static_cast<PartDesign::ShapeBinder*>(copy)->Shape;
}
}
else if (obj->isDerivedFrom(App::Plane::getClassTypeId())
|| obj->isDerivedFrom(App::Line::getClassTypeId())) {
else if (obj->isDerivedFrom<App::Plane>()
|| obj->isDerivedFrom<App::Line>()) {
copy = App::GetApplication().getActiveDocument()->addObject("PartDesign::ShapeBinder",
name.c_str());