Part: modernize C++: replace 'typedef' with 'using'

This commit is contained in:
wmayer
2022-08-29 19:31:50 +02:00
parent 7eb30ca5c7
commit c6a208bb18
30 changed files with 58 additions and 58 deletions

View File

@@ -130,7 +130,7 @@ private:
};
typedef App::ExtensionPythonT<AttachExtension> AttachExtensionPython;
using AttachExtensionPython = App::ExtensionPythonT<AttachExtension>;
} // namespace Part

View File

@@ -145,8 +145,8 @@ enum eRefType {
};
typedef std::vector<eRefType> refTypeString; //a sequence of ref types, according to Support contents for example
typedef std::vector<refTypeString> refTypeStringList; //a set of type strings, defines which selection sets are supported by a certain mode
using refTypeString = std::vector<eRefType>; //a sequence of ref types, according to Support contents for example
using refTypeStringList = std::vector<refTypeString>; //a set of type strings, defines which selection sets are supported by a certain mode
/**

View File

@@ -54,7 +54,7 @@ public:
}
};
typedef App::FeaturePythonT<CustomFeature> CustomFeaturePython;
using CustomFeaturePython = App::FeaturePythonT<CustomFeature>;
} //namespace Part

View File

@@ -77,7 +77,7 @@
using namespace Part;
typedef unsigned long UNICHAR; // ul is FT2's codepoint type <=> Py_UNICODE2/4
using UNICHAR = unsigned long; // ul is FT2's codepoint type <=> Py_UNICODE2/4
// Private function prototypes
PyObject* getGlyphContours(FT_Face FTFont, UNICHAR currchar, double PenPos, double Scale,int charNum, double tracking);

View File

@@ -101,8 +101,8 @@ PyObject * GeometryDefaultExtension<T>::getPyObject()
namespace Part {
// ----------------------------- Template specialisations----------------------------------------------------
//typedef Part::GeometryDefaultExtension<long> GeometryIntExtension;
//typedef Part::GeometryStringExtension<std::string> GeometryStringExtension;
//using GeometryIntExtension = Part::GeometryDefaultExtension<long>;
//using GeometryStringExtension = Part::GeometryStringExtension<std::string>;
// ---------- GeometryIntExtension ----------
TYPESYSTEM_SOURCE_TEMPLATE_T(Part::GeometryIntExtension,Part::GeometryPersistenceExtension)

View File

@@ -100,7 +100,7 @@ protected:
void handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName) override;
};
typedef App::FeaturePythonT<Part2DObject> Part2DObjectPython;
using Part2DObjectPython = App::FeaturePythonT<Part2DObject>;
} //namespace Part

View File

@@ -138,7 +138,7 @@ public:
short mustExecute() const override;
};
typedef App::FeaturePythonT<Feature> FeaturePython;
using FeaturePython = App::FeaturePythonT<Feature>;
/** Base class of all shape feature classes in FreeCAD

View File

@@ -29,7 +29,7 @@
namespace Py {
typedef ExtensionObject<Part::TopoShapePy> TopoShape;
using TopoShape = ExtensionObject<Part::TopoShapePy>;
template<>
bool TopoShape::accepts (PyObject *pyob) const;
}

View File

@@ -110,8 +110,8 @@ struct PartExport ShapeHistory {
* @brief MapList: key is index of subshape (of type 'type') in source
* shape. Value is list of indexes of subshapes in result shape.
*/
typedef std::map<int, std::vector<int> > MapList;
typedef std::vector<int> List;
using MapList = std::map<int, std::vector<int> >;
using List = std::vector<int>;
TopAbs_ShapeEnum type;
MapList shapeMap;

View File

@@ -50,8 +50,8 @@ namespace Base {
// Specialization for gp_Pnt
template <>
struct vec_traits<gp_Pnt> {
typedef gp_Pnt vec_type;
typedef double float_type;
using vec_type = gp_Pnt;
using float_type = double;
explicit vec_traits(const vec_type& v) : v(v){}
inline std::tuple<float_type,float_type,float_type> get() const {
return std::make_tuple(v.X(), v.Y(), v.Z());
@@ -62,8 +62,8 @@ private:
// Specialization for gp_Vec
template <>
struct vec_traits<gp_Vec> {
typedef gp_Vec vec_type;
typedef double float_type;
using vec_type = gp_Vec;
using float_type = double;
explicit vec_traits(const vec_type& v) : v(v){}
inline std::tuple<float_type,float_type,float_type> get() const {
return std::make_tuple(v.X(), v.Y(), v.Z());
@@ -74,8 +74,8 @@ private:
// Specialization for gp_Dir
template <>
struct vec_traits<gp_Dir> {
typedef gp_Dir vec_type;
typedef double float_type;
using vec_type = gp_Dir;
using float_type = double;
explicit vec_traits(const vec_type& v) : v(v){}
inline std::tuple<float_type,float_type,float_type> get() const {
return std::make_tuple(v.X(), v.Y(), v.Z());
@@ -86,8 +86,8 @@ private:
// Specialization for gp_XYZ
template <>
struct vec_traits<gp_XYZ> {
typedef gp_XYZ vec_type;
typedef double float_type;
using vec_type = gp_XYZ;
using float_type = double;
explicit vec_traits(const vec_type& v) : v(v){}
inline std::tuple<float_type,float_type,float_type> get() const {
return std::make_tuple(v.X(), v.Y(), v.Z());

View File

@@ -2473,7 +2473,7 @@ PyObject* _getSupportIndex(const char* suppStr, TopoShape* ts, TopoDS_Shape supp
PyObject* TopoShapePy::proximity(PyObject *args)
{
typedef BRepExtrema_MapOfIntegerPackedMapOfInteger BRepExtrema_OverlappedSubShapes;
using BRepExtrema_OverlappedSubShapes = BRepExtrema_MapOfIntegerPackedMapOfInteger;
PyObject* ps2;
Standard_Real tol = Precision::Confusion();

View File

@@ -52,10 +52,10 @@ struct Edgesort_gp_Pnt_Less
};
typedef std::vector<TopoDS_Edge> tEdgeVector;
typedef std::map<gp_Pnt,tEdgeVector,Edgesort_gp_Pnt_Less> tMapPntEdge;
typedef std::pair<gp_Pnt,tEdgeVector> tMapPntEdgePair;
typedef std::vector<std::vector<TopoDS_Edge> > tEdgeClusterVector;
using tEdgeVector = std::vector<TopoDS_Edge>;
using tMapPntEdge = std::map<gp_Pnt,tEdgeVector,Edgesort_gp_Pnt_Less>;
using tMapPntEdgePair = std::pair<gp_Pnt,tEdgeVector>;
using tEdgeClusterVector = std::vector<std::vector<TopoDS_Edge> >;
class PartExport Edgecluster

View File

@@ -44,10 +44,10 @@
namespace ModelRefine
{
typedef std::vector<TopoDS_Face> FaceVectorType;
typedef std::vector<TopoDS_Edge> EdgeVectorType;
typedef std::vector<TopoDS_Shape> ShapeVectorType;
typedef std::pair<TopoDS_Shape, TopoDS_Shape> ShapePairType;
using FaceVectorType = std::vector<TopoDS_Face>;
using EdgeVectorType = std::vector<TopoDS_Edge>;
using ShapeVectorType = std::vector<TopoDS_Shape>;
using ShapePairType = std::pair<TopoDS_Shape, TopoDS_Shape>;
void getFaceEdges(const TopoDS_Face &face, EdgeVectorType &edges);
void boundaryEdges(const FaceVectorType &faces, EdgeVectorType &edgesOut);
@@ -112,7 +112,7 @@ namespace ModelRefine
class FaceTypeSplitter
{
typedef std::map<GeomAbs_SurfaceType, FaceVectorType> SplitMapType;
using SplitMapType = std::map<GeomAbs_SurfaceType, FaceVectorType>;
public:
FaceTypeSplitter(){}
void addShell(const TopoDS_Shell &shellIn);

View File

@@ -36,7 +36,7 @@
namespace AttacherGui {
typedef std::vector<QString> TextSet;
using TextSet = std::vector<QString>;
/**
* @brief getUIStrings

View File

@@ -35,7 +35,7 @@ class Property;
}
namespace PartGui {
typedef boost::signals2::connection Connection;
using Connection = boost::signals2::connection;
class Ui_DlgBooleanOperation;
class DlgBooleanOperation : public QWidget
{

View File

@@ -206,7 +206,7 @@ namespace PartGui {
std::vector<int> edge_ids;
TopTools_IndexedMapOfShape all_edges;
TopTools_IndexedMapOfShape all_faces;
typedef boost::signals2::connection Connection;
using Connection = boost::signals2::connection;
Connection connectApplicationDeletedObject;
Connection connectApplicationDeletedDocument;

View File

@@ -27,7 +27,7 @@
namespace PartGui {
class Ui_DlgPartBox;
typedef std::shared_ptr<Ui_DlgPartBox> Ui_DlgPartBoxPtr;
using Ui_DlgPartBoxPtr = std::shared_ptr<Ui_DlgPartBox>;
class DlgPartBoxImp : public Gui::LocationDialogUiImp
{

View File

@@ -27,7 +27,7 @@
namespace PartGui {
class Ui_DlgPartCylinder;
typedef std::shared_ptr<Ui_DlgPartCylinder> Ui_DlgPartCylinderPtr;
using Ui_DlgPartCylinderPtr = std::shared_ptr<Ui_DlgPartCylinder>;
class DlgPartCylinderImp : public Gui::LocationDialogUiImp
{

View File

@@ -43,7 +43,7 @@ class SoTextureCoordinateBundle;
namespace PartGui {
class PartGuiExport SoBrepEdgeSet : public SoIndexedLineSet {
typedef SoIndexedLineSet inherited;
using inherited = SoIndexedLineSet;
SO_NODE_HEADER(SoBrepEdgeSet);
@@ -52,7 +52,7 @@ public:
SoBrepEdgeSet();
protected:
~SoBrepEdgeSet() override {};
~SoBrepEdgeSet() override {}
void GLRender(SoGLRenderAction *action) override;
void GLRenderBelowPath(SoGLRenderAction * action) override;
void doAction(SoAction* action) override;
@@ -66,7 +66,7 @@ protected:
private:
struct SelContext;
typedef std::shared_ptr<SelContext> SelContextPtr;
using SelContextPtr = std::shared_ptr<SelContext>;
void renderShape(const SoGLCoordinateElement * const vertexlist,
const int32_t *vertexindices, int num_vertexindices);

View File

@@ -77,7 +77,7 @@ namespace PartGui {
* As an example how to use the class correctly see ViewProviderPartExt::updateVisual().
*/
class PartGuiExport SoBrepFaceSet : public SoIndexedFaceSet {
typedef SoIndexedFaceSet inherited;
using inherited = SoIndexedFaceSet;
SO_NODE_HEADER(SoBrepFaceSet);
@@ -131,8 +131,8 @@ private:
const int mbind,
SbBool texture);
typedef Gui::SoFCSelectionContextEx SelContext;
typedef Gui::SoFCSelectionContextExPtr SelContextPtr;
using SelContext = Gui::SoFCSelectionContextEx;
using SelContextPtr = Gui::SoFCSelectionContextExPtr;
void renderHighlight(SoGLRenderAction *action, SelContextPtr);
void renderSelection(SoGLRenderAction *action, SelContextPtr, bool push=true);

View File

@@ -43,7 +43,7 @@ class SoTextureCoordinateBundle;
namespace PartGui {
class PartGuiExport SoBrepPointSet : public SoPointSet {
typedef SoPointSet inherited;
using inherited = SoPointSet;
SO_NODE_HEADER(SoBrepPointSet);
@@ -52,7 +52,7 @@ public:
SoBrepPointSet();
protected:
~SoBrepPointSet() override {};
~SoBrepPointSet() override {}
void GLRender(SoGLRenderAction *action) override;
void GLRenderBelowPath(SoGLRenderAction * action) override;
void doAction(SoAction* action) override;
@@ -60,8 +60,8 @@ protected:
void getBoundingBox(SoGetBoundingBoxAction * action) override;
private:
typedef Gui::SoFCSelectionContext SelContext;
typedef Gui::SoFCSelectionContextPtr SelContextPtr;
using SelContext = Gui::SoFCSelectionContext;
using SelContextPtr = Gui::SoFCSelectionContextPtr;
void renderHighlight(SoGLRenderAction *action, SelContextPtr);
void renderSelection(SoGLRenderAction *action, SelContextPtr, bool push=true);

View File

@@ -34,7 +34,7 @@
namespace PartGui {
class PartGuiExport SoFCControlPoints : public SoShape {
typedef SoShape inherited;
using inherited = SoShape;
SO_NODE_HEADER(SoFCControlPoints);

View File

@@ -53,8 +53,8 @@ class PartGuiExport TaskAttacher : public Gui::TaskView::TaskBox, public Gui::Se
Q_OBJECT
public:
typedef std::function<void (bool, const std::string &, Gui::ViewProviderDocumentObject*,
App::DocumentObject *, const std::string&)> VisibilityFunction;
using VisibilityFunction = std::function<void (bool, const std::string &, Gui::ViewProviderDocumentObject*,
App::DocumentObject *, const std::string&)>;
explicit TaskAttacher(Gui::ViewProviderDocumentObject *ViewProvider, QWidget *parent = nullptr,
QString picture = QString(),
@@ -140,7 +140,7 @@ private:
Attacher::SuggestResult lastSuggestResult;
bool completed;
typedef boost::signals2::connection Connection;
using Connection = boost::signals2::connection;
Connection connectDelObject;
Connection connectDelDocument;
};

View File

@@ -74,8 +74,8 @@ void goSetupResultInvalidCurveSurface(ResultEntry *entry);
void goSetupResultInvalidSameParameterFlag(ResultEntry *entry);
void goSetupResultUnorientableShapeFace(ResultEntry *entry);
typedef std::function<void (ResultEntry *entry)> ResultFunction;
typedef std::tuple<TopAbs_ShapeEnum, BRepCheck_Status, ResultFunction> FunctionMapType;
using ResultFunction = std::function<void (ResultEntry *entry)>;
using FunctionMapType = std::tuple<TopAbs_ShapeEnum, BRepCheck_Status, ResultFunction>;
class ResultModel : public QAbstractItemModel
{

View File

@@ -199,7 +199,7 @@ public:
void setIconDone(const uint &index);
protected:
typedef std::pair<QPushButton *, QLabel *> ButtonIconPairType;
using ButtonIconPairType = std::pair<QPushButton *, QLabel *>;
std::vector<ButtonIconPairType> buttons;
QPixmap *stepActive;
QPixmap *stepDone;

View File

@@ -89,7 +89,7 @@ namespace PartGui {
class FaceColors::Private
{
public:
typedef boost::signals2::connection Connection;
using Connection = boost::signals2::connection;
Ui_TaskFaceColors* ui;
QPointer<Gui::View3DInventorViewer> view;
ViewProviderPartExt* vp;

View File

@@ -98,7 +98,7 @@ private:
float MaxY;
};
typedef Gui::ViewProviderPythonFeatureT<ViewProvider2DObject> ViewProvider2DObjectPython;
using ViewProvider2DObjectPython = Gui::ViewProviderPythonFeatureT<ViewProvider2DObject>;
} // namespace PartGui

View File

@@ -48,7 +48,7 @@ private:
void showAttachmentEditor();
};
typedef Gui::ViewProviderExtensionPythonT<PartGui::ViewProviderAttachExtension> ViewProviderAttachExtensionPython;
using ViewProviderAttachExtensionPython = Gui::ViewProviderExtensionPythonT<PartGui::ViewProviderAttachExtension>;
} //namespace Part::Gui

View File

@@ -45,8 +45,8 @@ protected:
std::map<const App::Property*, Gui::ViewProvider*> propView;
};
typedef Gui::ViewProviderPythonFeatureT<ViewProviderPart> ViewProviderPython;
typedef Gui::ViewProviderPythonFeatureT<ViewProviderCustom> ViewProviderCustomPython;
using ViewProviderPython = Gui::ViewProviderPythonFeatureT<ViewProviderPart>;
using ViewProviderCustomPython = Gui::ViewProviderPythonFeatureT<ViewProviderCustom>;
} // namespace PartGui

View File

@@ -69,7 +69,7 @@ private:
ViewProviderSplineExtension extension;
};
typedef Gui::ViewProviderExtensionPythonT<PartGui::ViewProviderSplineExtension> ViewProviderSplineExtensionPython;
using ViewProviderSplineExtensionPython = Gui::ViewProviderExtensionPythonT<PartGui::ViewProviderSplineExtension>;
} //namespace PartGui