Part: modernize C++: use default member init

This commit is contained in:
wmayer
2023-08-22 23:18:03 +02:00
committed by wwmayer
parent 8c2e110bfb
commit bc8e9f5f29
27 changed files with 48 additions and 91 deletions

View File

@@ -34,7 +34,6 @@ using namespace Attacher;
EXTENSION_PROPERTY_SOURCE(Part::AttachExtension, App::DocumentObjectExtension)
AttachExtension::AttachExtension()
: _attacher(nullptr)
{
EXTENSION_ADD_PROPERTY_TYPE(AttacherType, ("Attacher::AttachEngine3D"), "Attachment",(App::PropertyType)(App::Prop_None),"Class name of attach engine object driving the attachment.");
this->AttacherType.setStatus(App::Property::Status::Hidden, true);

View File

@@ -125,7 +125,7 @@ public:
void updateAttacherVals();
private:
Attacher::AttachEngine* _attacher;
Attacher::AttachEngine* _attacher = nullptr;
mutable int _active = -1;
};

View File

@@ -169,11 +169,7 @@ const char* AttachEngine::eRefTypeStrings[]= {
TYPESYSTEM_SOURCE_ABSTRACT(Attacher::AttachEngine, Base::BaseClass)
AttachEngine::AttachEngine()
: mapMode(mmDeactivated), mapReverse(false), attachParameter(0.0),
surfU(0.0), surfV(0.0)
{
}
AttachEngine::AttachEngine() = default;
void AttachEngine::setUp(const App::PropertyLinkSubList &references,
eMapMode mapMode, bool mapReverse,

View File

@@ -363,10 +363,10 @@ public: //enums
public: //members
App::PropertyLinkSubList references;
eMapMode mapMode;
bool mapReverse;
double attachParameter;
double surfU, surfV;
eMapMode mapMode = mmDeactivated;
bool mapReverse = false;
double attachParameter = 0.0;
double surfU = 0.0, surfV = 0.0;
Base::Placement attachmentOffset;
/**

View File

@@ -45,8 +45,7 @@ class PartExport FaceMakerBullseye: public FaceMakerPublic
{
TYPESYSTEM_HEADER_WITH_OVERRIDE();
public:
FaceMakerBullseye()
:planeSupplied(false){}
FaceMakerBullseye() = default;
/**
* @brief setPlane: sets the plane to use when making faces. This is
* optional. If the plane was set, it is not tested that the wires are
@@ -63,7 +62,7 @@ protected:
protected:
gp_Pln myPlane; //externally supplied plane (if any)
bool planeSupplied;
bool planeSupplied{false};
/**
* @brief The FaceDriller class is similar to BRepBuilderAPI_MakeFace,

View File

@@ -61,13 +61,12 @@ public:
*/
struct ExtrusionParameters {
gp_Dir dir;
double lengthFwd;
double lengthRev;
bool solid;
double taperAngleFwd; //in radians
double taperAngleRev;
double lengthFwd{0};
double lengthRev{0};
bool solid{false};
double taperAngleFwd{0}; //in radians
double taperAngleRev{0};
std::string faceMakerClass;
ExtrusionParameters(): lengthFwd(0), lengthRev(0), solid(false), taperAngleFwd(0), taperAngleRev(0) {}// constructor to keep garbage out
};
/** @name methods override feature */

View File

@@ -32,11 +32,6 @@ using namespace Part;
//---------- Geometry Extension
TYPESYSTEM_SOURCE(Part::GeometryMigrationExtension,Part::GeometryExtension)
GeometryMigrationExtension::GeometryMigrationExtension():ConstructionState(false)
{
}
void GeometryMigrationExtension::copyAttributes(Part::GeometryExtension * cpy) const
{
Part::GeometryExtension::copyAttributes(cpy);

View File

@@ -52,7 +52,7 @@ public:
NumMigrationType // Must be the last
};
GeometryMigrationExtension();
GeometryMigrationExtension() = default;
~GeometryMigrationExtension() override = default;
std::unique_ptr<Part::GeometryExtension> copy() const override;
@@ -75,7 +75,7 @@ private:
private:
using MigrationTypeFlagType = std::bitset<32>;
MigrationTypeFlagType GeometryMigrationFlags;
bool ConstructionState;
bool ConstructionState{false};
};

View File

@@ -35,7 +35,7 @@
using namespace Part;
Edgecluster::Edgecluster(const std::vector<TopoDS_Edge>& unsorted_edges)
:m_unsortededges(unsorted_edges),m_done(false)
:m_unsortededges(unsorted_edges)
{
m_edges.clear();
m_vertices.clear();

View File

@@ -77,7 +77,7 @@ private:
tEdgeVector m_edges;
tMapPntEdge m_vertices;
bool m_done;
bool m_done{false};
tEdgeVector::const_iterator m_edgeIter;

View File

@@ -67,12 +67,7 @@ public:
}
};
BoxSelection::BoxSelection()
: autodelete(false)
, shapeEnum(TopAbs_SHAPE)
{
}
BoxSelection::BoxSelection() = default;
BoxSelection::~BoxSelection() = default;

View File

@@ -61,8 +61,8 @@ private:
static void selectionCallback(void * ud, SoEventCallback * cb);
private:
bool autodelete;
TopAbs_ShapeEnum shapeEnum;
bool autodelete{false};
TopAbs_ShapeEnum shapeEnum{TopAbs_SHAPE};
};
} //namespace PartGui

View File

@@ -165,11 +165,12 @@ QVariant FilletRadiusModel::data(const QModelIndex& index, int role) const
namespace PartGui {
class EdgeFaceSelection : public Gui::SelectionFilterGate
{
bool allowEdge;
bool allowEdge{true};
App::DocumentObject*& object;
public:
explicit EdgeFaceSelection(App::DocumentObject*& obj)
: Gui::SelectionFilterGate(nullPointer()), allowEdge(true), object(obj)
: Gui::SelectionFilterGate(nullPointer())
, object(obj)
{
}
void selectEdges()

View File

@@ -61,9 +61,6 @@ namespace PartGui {
class Picker
{
public:
Picker() : exitCode(-1)
{
}
virtual ~Picker() = default;
virtual bool pickedPoint(const SoPickedPoint * point) = 0;
@@ -71,7 +68,7 @@ public:
void createPrimitive(QWidget* widget, const QString&, Gui::Document*);
QString toPlacement(const gp_Ax2&) const;
int exitCode;
int exitCode{-1};
QEventLoop loop;
};

View File

@@ -66,7 +66,6 @@ void SoBrepEdgeSet::initClass()
SoBrepEdgeSet::SoBrepEdgeSet()
: selContext(std::make_shared<SelContext>())
, selContext2(std::make_shared<SelContext>())
, packedColor(0)
{
SO_NODE_CONSTRUCTOR(SoBrepEdgeSet);
}

View File

@@ -72,7 +72,7 @@ private:
SelContextPtr selContext;
SelContextPtr selContext2;
Gui::SoFCSelectionCounter selCounter;
uint32_t packedColor;
uint32_t packedColor{0};
};
} // namespace PartGui

View File

@@ -60,7 +60,6 @@ void SoBrepPointSet::initClass()
SoBrepPointSet::SoBrepPointSet()
: selContext(std::make_shared<SelContext>())
, selContext2(std::make_shared<SelContext>())
, packedColor(0)
{
SO_NODE_CONSTRUCTOR(SoBrepPointSet);
}

View File

@@ -63,7 +63,7 @@ private:
SelContextPtr selContext;
SelContextPtr selContext2;
Gui::SoFCSelectionCounter selCounter;
uint32_t packedColor;
uint32_t packedColor{0};
};
} // namespace PartGui

View File

@@ -45,12 +45,8 @@ using namespace PartGui;
class OffsetWidget::Private
{
public:
Ui_TaskOffset ui;
Part::Offset* offset;
Private() : offset(nullptr)
{
}
~Private() = default;
Ui_TaskOffset ui{};
Part::Offset* offset{nullptr};
};
/* TRANSLATOR PartGui::OffsetWidget */

View File

@@ -56,9 +56,9 @@ namespace PartGui {
{
public:
enum Type {VERTEX, EDGE, FACE, ALL};
Type mode;
Type mode{ALL};
ShapeSelection()
: Gui::SelectionFilterGate(nullPointer()), mode(ALL)
: Gui::SelectionFilterGate(nullPointer())
{
}
void setMode(Type mode)

View File

@@ -48,14 +48,10 @@ using namespace PartGui;
class ThicknessWidget::Private
{
public:
Ui_TaskOffset ui;
Ui_TaskOffset ui{};
QString text;
std::string selection;
Part::Thickness* thickness;
Private() : thickness(nullptr)
{
}
~Private() = default;
Part::Thickness* thickness{nullptr};
class FaceSelection : public Gui::SelectionFilterGate
{

View File

@@ -58,7 +58,6 @@ PROPERTY_SOURCE(PartGui::ViewProviderCurveNet,PartGui::ViewProviderPart)
ViewProviderCurveNet::ViewProviderCurveNet()
: bInEdit(false),bMovePointMode(false),EdgeRoot(nullptr),VertexRoot(nullptr)
{
LineWidth.setValue(4.0f);
PointSize.setValue(0.05f);

View File

@@ -76,11 +76,11 @@ protected:
std::list<Node> NodeList;
bool bInEdit;
bool bMovePointMode;
bool bInEdit{false};
bool bMovePointMode{false};
Node PointToMove;
/// root of the edge and vertex points
SoSeparator *EdgeRoot, *VertexRoot;
SoSeparator *EdgeRoot{nullptr}, *VertexRoot{nullptr};
Standard_Boolean computeEdges (SoSeparator* root, const TopoDS_Shape &myShape);
Standard_Boolean computeVertices(SoSeparator* root, const TopoDS_Shape &myShape);

View File

@@ -48,18 +48,6 @@ PROPERTY_SOURCE(PartGui::ViewProviderPartReference, Gui::ViewProviderGeometryObj
// Construction/Destruction
ViewProviderPartReference::ViewProviderPartReference()
: EdgeRoot(nullptr)
, FaceRoot(nullptr)
, VertexRoot(nullptr)
, pcLineMaterial(nullptr)
, pcPointMaterial(nullptr)
, pcLineStyle(nullptr)
, pcPointStyle(nullptr)
, pcControlPoints(nullptr)
, pShapeHints(nullptr)
, meshDeviation(0.01f)
, noPerVertexNormals(true)
, qualityNormals(false)
{
App::Material mat;
mat.ambientColor.set(0.2f,0.2f,0.2f);

View File

@@ -86,21 +86,21 @@ protected:
//bool loadParameter();
// nodes for the data representation
SoGroup *EdgeRoot;
SoGroup *FaceRoot;
SoGroup *VertexRoot;
SoMaterial *pcLineMaterial;
SoMaterial *pcPointMaterial;
SoDrawStyle *pcLineStyle;
SoDrawStyle *pcPointStyle;
SoSwitch *pcControlPoints;
SoShapeHints *pShapeHints;
SoGroup *EdgeRoot{nullptr};
SoGroup *FaceRoot{nullptr};
SoGroup *VertexRoot{nullptr};
SoMaterial *pcLineMaterial{nullptr};
SoMaterial *pcPointMaterial{nullptr};
SoDrawStyle *pcLineStyle{nullptr};
SoDrawStyle *pcPointStyle{nullptr};
SoSwitch *pcControlPoints{nullptr};
SoShapeHints *pShapeHints{nullptr};
private:
// settings stuff
float meshDeviation;
bool noPerVertexNormals;
bool qualityNormals;
float meshDeviation{0.01F};
bool noPerVertexNormals{true};
bool qualityNormals{false};
static App::PropertyFloatConstraint::Constraints floatRange;
static const char* LightingEnums[];
};

View File

@@ -77,7 +77,6 @@ EXTENSION_PROPERTY_SOURCE(PartGui::ViewProviderSplineExtension, Gui::ViewProvide
ViewProviderSplineExtension::ViewProviderSplineExtension()
: pcControlPoints(nullptr)
{
initExtensionType(ViewProviderSplineExtension::getExtensionClassTypeId());
EXTENSION_ADD_PROPERTY(ControlPoints,(false));

View File

@@ -50,7 +50,7 @@ protected:
void showControlPointsOfEdge(const TopoDS_Edge&);
void showControlPointsOfFace(const TopoDS_Face&);
SoSwitch *pcControlPoints;
SoSwitch *pcControlPoints{nullptr};
};
class PartGuiExport ViewProviderSpline : public ViewProviderPartExt