diff --git a/src/Mod/PartDesign/App/Body.cpp b/src/Mod/PartDesign/App/Body.cpp index 25948d3fb0..81cc0258fe 100644 --- a/src/Mod/PartDesign/App/Body.cpp +++ b/src/Mod/PartDesign/App/Body.cpp @@ -173,9 +173,9 @@ bool Body::isAfterInsertPoint(App::DocumentObject* feature) { } } -bool Body::isMemberOfMultiTransform(const App::DocumentObject* f) +bool Body::isMemberOfMultiTransform(const App::DocumentObject* obj) { - if (f == nullptr) + if (!obj) return false; // ORIGINAL COMMENT: @@ -189,38 +189,38 @@ bool Body::isMemberOfMultiTransform(const App::DocumentObject* f) // to auto set it when the originals are not null. See: // App::DocumentObjectExecReturn *Transformed::execute(void) // - return (f->getTypeId().isDerivedFrom(PartDesign::Transformed::getClassTypeId()) && - static_cast(f)->Originals.getValues().empty()); + return (obj->getTypeId().isDerivedFrom(PartDesign::Transformed::getClassTypeId()) && + static_cast(obj)->Originals.getValues().empty()); } -bool Body::isSolidFeature(const App::DocumentObject* f) +bool Body::isSolidFeature(const App::DocumentObject *obj) { - if (f == nullptr) + if (!obj) return false; - if (f->getTypeId().isDerivedFrom(PartDesign::Feature::getClassTypeId()) && - !PartDesign::Feature::isDatum(f)) { + if (obj->getTypeId().isDerivedFrom(PartDesign::Feature::getClassTypeId()) && + !PartDesign::Feature::isDatum(obj)) { // Transformed Features inside a MultiTransform are not solid features - return !isMemberOfMultiTransform(f); + return !isMemberOfMultiTransform(obj); } return false;//DeepSOIC: work-in-progress? } -bool Body::isAllowed(const App::DocumentObject* f) +bool Body::isAllowed(const App::DocumentObject *obj) { - if (f == nullptr) + if (!obj) return false; // TODO: Should we introduce a PartDesign::FeaturePython class? This should then also return true for isSolidFeature() - return (f->getTypeId().isDerivedFrom(PartDesign::Feature::getClassTypeId()) || - f->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId()) || + return (obj->getTypeId().isDerivedFrom(PartDesign::Feature::getClassTypeId()) || + obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId()) || // TODO Shouldn't we replace it with Sketcher::SketchObject? (2015-08-13, Fat-Zer) - f->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId()) || - f->getTypeId().isDerivedFrom(PartDesign::ShapeBinder::getClassTypeId()) || - f->getTypeId().isDerivedFrom(PartDesign::SubShapeBinder::getClassTypeId()) + obj->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId()) || + obj->getTypeId().isDerivedFrom(PartDesign::ShapeBinder::getClassTypeId()) || + obj->getTypeId().isDerivedFrom(PartDesign::SubShapeBinder::getClassTypeId()) // TODO Why this lines was here? why should we allow anything of those? (2015-08-13, Fat-Zer) - //f->getTypeId().isDerivedFrom(Part::FeaturePython::getClassTypeId()) // trouble with this line on Windows!? Linker fails to find getClassTypeId() of the Part::FeaturePython... - //f->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()) + //obj->getTypeId().isDerivedFrom(Part::FeaturePython::getClassTypeId()) // trouble with this line on Windows!? Linker fails to find getClassTypeId() of the Part::FeaturePython... + //obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()) ); } diff --git a/src/Mod/PartDesign/App/Body.h b/src/Mod/PartDesign/App/Body.h index 33e83307e7..4b57f61969 100644 --- a/src/Mod/PartDesign/App/Body.h +++ b/src/Mod/PartDesign/App/Body.h @@ -91,21 +91,23 @@ public: bool isAfterInsertPoint(App::DocumentObject* feature); /// Return true if the given feature is member of a MultiTransform feature - static bool isMemberOfMultiTransform(const App::DocumentObject* f); + static bool isMemberOfMultiTransform(const App::DocumentObject *obj); /** * Return true if the given feature is a solid feature allowed in a Body. Currently this is only valid * for features derived from PartDesign::Feature * Return false if the given feature is a Sketch or a Part::Datum feature */ - static bool isSolidFeature(const App::DocumentObject* f); + static bool isSolidFeature(const App::DocumentObject *obj); /** * Return true if the given feature is allowed in a Body. Currently allowed are * all features derived from PartDesign::Feature and Part::Datum and sketches */ - static bool isAllowed(const App::DocumentObject* f); - virtual bool allowObject(DocumentObject* f) override {return isAllowed(f);} + static bool isAllowed(const App::DocumentObject *obj); + virtual bool allowObject(DocumentObject *obj) override { + return isAllowed(obj); + } /** * Return the body which this feature belongs too, or NULL diff --git a/src/Mod/PartDesign/App/Feature.cpp b/src/Mod/PartDesign/App/Feature.cpp index 4801586d3a..038843f961 100644 --- a/src/Mod/PartDesign/App/Feature.cpp +++ b/src/Mod/PartDesign/App/Feature.cpp @@ -197,7 +197,7 @@ bool Feature::isDatum(const App::DocumentObject* feature) gp_Pln Feature::makePlnFromPlane(const App::DocumentObject* obj) { const App::GeoFeature* plane = static_cast(obj); - if (plane == nullptr) + if (!plane) throw Base::ValueError("Feature: Null object"); Base::Vector3d pos = plane->Placement.getValue().getPosition(); diff --git a/src/Mod/PartDesign/App/FeatureDraft.cpp b/src/Mod/PartDesign/App/FeatureDraft.cpp index c8d2b935a9..54eb948573 100644 --- a/src/Mod/PartDesign/App/FeatureDraft.cpp +++ b/src/Mod/PartDesign/App/FeatureDraft.cpp @@ -155,7 +155,7 @@ App::DocumentObjectExecReturn *Draft::execute(void) // Neutral plane gp_Pln neutralPlane; App::DocumentObject* refPlane = NeutralPlane.getValue(); - if (refPlane == nullptr) { + if (!refPlane) { // Try to guess a neutral plane from the first selected face // Get edges of first selected face TopoDS_Shape face = TopShape.getSubShape(SubVals[0].c_str()); @@ -255,7 +255,7 @@ App::DocumentObjectExecReturn *Draft::execute(void) neutralPlane.Transform(invObjLoc.Transformation()); } - if (refDirection == nullptr) { + if (!refDirection) { // Choose pull direction normal to neutral plane pullDirection = neutralPlane.Axis().Direction(); } diff --git a/src/Mod/PartDesign/App/FeatureLinearPattern.cpp b/src/Mod/PartDesign/App/FeatureLinearPattern.cpp index fc1d1e192f..a98c5fe7cd 100644 --- a/src/Mod/PartDesign/App/FeatureLinearPattern.cpp +++ b/src/Mod/PartDesign/App/FeatureLinearPattern.cpp @@ -81,7 +81,7 @@ const std::list LinearPattern::getTransformations(const std::vector subStrings = Direction.getSubValues(); diff --git a/src/Mod/PartDesign/App/FeatureMirrored.cpp b/src/Mod/PartDesign/App/FeatureMirrored.cpp index 5e72f04f66..63e489ef6f 100644 --- a/src/Mod/PartDesign/App/FeatureMirrored.cpp +++ b/src/Mod/PartDesign/App/FeatureMirrored.cpp @@ -60,7 +60,7 @@ short Mirrored::mustExecute() const const std::list Mirrored::getTransformations(const std::vector) { App::DocumentObject* refObject = MirrorPlane.getValue(); - if (refObject == nullptr) + if (!refObject) throw Base::ValueError("No mirror plane reference specified"); std::vector subStrings = MirrorPlane.getSubValues(); if (subStrings.empty()) diff --git a/src/Mod/PartDesign/App/FeaturePocket.cpp b/src/Mod/PartDesign/App/FeaturePocket.cpp index ce56376098..2aa3294643 100644 --- a/src/Mod/PartDesign/App/FeaturePocket.cpp +++ b/src/Mod/PartDesign/App/FeaturePocket.cpp @@ -73,7 +73,7 @@ App::DocumentObjectExecReturn *Pocket::execute() // Handle legacy features, these typically have Type set to 3 (previously NULL, now UpToFace), // empty FaceName (because it didn't exist) and a value for Length if (std::string(Type.getValueAsString()) == "UpToFace" && - (UpToFace.getValue() == nullptr && Length.getValue() > Precision::Confusion())) + (!UpToFace.getValue() && Length.getValue() > Precision::Confusion())) Type.setValue("Length"); // Validate parameters diff --git a/src/Mod/PartDesign/App/FeaturePolarPattern.cpp b/src/Mod/PartDesign/App/FeaturePolarPattern.cpp index dfce427225..c2d6c0e13f 100644 --- a/src/Mod/PartDesign/App/FeaturePolarPattern.cpp +++ b/src/Mod/PartDesign/App/FeaturePolarPattern.cpp @@ -98,7 +98,7 @@ const std::list PolarPattern::getTransformations(const std::vector subStrings = Axis.getSubValues(); if (subStrings.empty()) diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index e33bb1d131..17eb6e23ac 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -422,7 +422,7 @@ void ProfileBased::getFaceFromLinkSub(TopoDS_Face& upToFace, const App::Property App::DocumentObject* ref = refFace.getValue(); std::vector subStrings = refFace.getSubValues(); - if (ref == nullptr) + if (!ref) throw Base::ValueError("SketchBased: No face selected"); if (ref->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {