From 236b40ab6595e2bdc6da4f889299da77ede02cbf Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 29 Aug 2022 22:21:01 +0200 Subject: [PATCH] Path: modernize C++: replace 'typedef' with 'using' --- src/Mod/Path/App/Area.cpp | 20 ++++++++++---------- src/Mod/Path/App/FeatureArea.h | 4 ++-- src/Mod/Path/App/FeaturePath.h | 2 +- src/Mod/Path/App/FeaturePathCompound.h | 2 +- src/Mod/Path/App/FeaturePathShape.h | 2 +- src/Mod/Path/App/Voronoi.h | 20 ++++++++++---------- src/Mod/Path/App/VoronoiPyImp.cpp | 4 ++-- src/Mod/Path/Gui/ViewProviderArea.h | 4 ++-- src/Mod/Path/Gui/ViewProviderPath.h | 4 ++-- src/Mod/Path/Gui/ViewProviderPathCompound.h | 2 +- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/Mod/Path/App/Area.cpp b/src/Mod/Path/App/Area.cpp index 03e0b4eef9..b216e2fa3d 100644 --- a/src/Mod/Path/App/Area.cpp +++ b/src/Mod/Path/App/Area.cpp @@ -107,7 +107,7 @@ namespace bg = boost::geometry; namespace bgi = boost::geometry::index; -typedef bgi::linear<16> RParameters; +using RParameters = bgi::linear<16>; BOOST_GEOMETRY_REGISTER_POINT_3D_GET_SET( gp_Pnt, double, bg::cs::cartesian, X, Y, Z, SetX, SetY, SetZ) @@ -568,7 +568,7 @@ static inline void getEndPoints(const TopoDS_Wire& wire, gp_Pnt& p1, gp_Pnt& p2) struct WireJoiner { - typedef bg::model::box Box; + using Box = bg::model::box; static bool getBBox(const TopoDS_Edge& e, Box& box) { Bnd_Box bound; @@ -616,7 +616,7 @@ struct WireJoiner { } }; - typedef std::list Edges; + using Edges = std::list; Edges edges; struct VertexInfo { @@ -638,7 +638,7 @@ struct WireJoiner { struct PntGetter { - typedef const gp_Pnt& result_type; + using result_type = const gp_Pnt&; result_type operator()(const VertexInfo& v) const { return v.pt(); } @@ -648,7 +648,7 @@ struct WireJoiner { struct BoxGetter { - typedef const Box& result_type; + using result_type = const Box&; result_type operator()(Edges::iterator it) const { return it->box; } @@ -2343,15 +2343,15 @@ struct WireInfo { } }; -typedef std::list Wires; -typedef std::pair RValue; +using Wires = std::list; +using RValue = std::pair; struct RGetter { - typedef const gp_Pnt& result_type; + using result_type = const gp_Pnt&; result_type operator()(const RValue& v) const { return v.first->points[v.second]; } }; -typedef bgi::rtree RTree; +using RTree = bgi::rtree; struct ShapeParams { double abscissa; @@ -2374,7 +2374,7 @@ struct ShapeParams { bool operator<(const Wires::iterator& a, const Wires::iterator& b) { return &(*a) < &(*b); } -typedef std::map RResults; +using RResults = std::map; struct GetWires { Wires& wires; diff --git a/src/Mod/Path/App/FeatureArea.h b/src/Mod/Path/App/FeatureArea.h index a4fd904f07..6dfd90b2fc 100644 --- a/src/Mod/Path/App/FeatureArea.h +++ b/src/Mod/Path/App/FeatureArea.h @@ -70,7 +70,7 @@ private: bool myInited; }; -typedef App::FeaturePythonT FeatureAreaPython; +using FeatureAreaPython = App::FeaturePythonT; class PathExport FeatureAreaView : public Part::Feature { @@ -92,7 +92,7 @@ public: App::PropertyInteger SectionCount; }; -typedef App::FeaturePythonT FeatureAreaViewPython; +using FeatureAreaViewPython = App::FeaturePythonT; } //namespace Path diff --git a/src/Mod/Path/App/FeaturePath.h b/src/Mod/Path/App/FeaturePath.h index b3356c1381..926b671b60 100644 --- a/src/Mod/Path/App/FeaturePath.h +++ b/src/Mod/Path/App/FeaturePath.h @@ -64,7 +64,7 @@ protected: }; -typedef App::FeaturePythonT FeaturePython; +using FeaturePython = App::FeaturePythonT; } //namespace Path diff --git a/src/Mod/Path/App/FeaturePathCompound.h b/src/Mod/Path/App/FeaturePathCompound.h index 87d41466c1..cf46f8239e 100644 --- a/src/Mod/Path/App/FeaturePathCompound.h +++ b/src/Mod/Path/App/FeaturePathCompound.h @@ -64,7 +64,7 @@ public: }; -typedef App::FeaturePythonT FeatureCompoundPython; +using FeatureCompoundPython = App::FeaturePythonT; } //namespace Path diff --git a/src/Mod/Path/App/FeaturePathShape.h b/src/Mod/Path/App/FeaturePathShape.h index 2480f9fcbb..df8723020b 100644 --- a/src/Mod/Path/App/FeaturePathShape.h +++ b/src/Mod/Path/App/FeaturePathShape.h @@ -72,7 +72,7 @@ protected: }; -typedef App::FeaturePythonT FeatureShapePython; +using FeatureShapePython = App::FeaturePythonT; } //namespace Path diff --git a/src/Mod/Path/App/Voronoi.h b/src/Mod/Path/App/Voronoi.h index 73c0b8459a..98a8a8c779 100644 --- a/src/Mod/Path/App/Voronoi.h +++ b/src/Mod/Path/App/Voronoi.h @@ -50,16 +50,16 @@ namespace Path Voronoi(); ~Voronoi(); - typedef std::size_t color_type; + using color_type = std::size_t; static const int InvalidIndex = INT_MAX; static const color_type ColorMask = PATH_VORONOI_COLOR_MASK; // types - typedef double coordinate_type; - typedef boost::polygon::voronoi_vertex vertex_type; - typedef boost::polygon::point_data point_type; - typedef boost::polygon::segment_data segment_type; - typedef boost::polygon::voronoi_diagram voronoi_diagram_type; + using coordinate_type = double; + using vertex_type = boost::polygon::voronoi_vertex; + using point_type = boost::polygon::point_data; + using segment_type = boost::polygon::segment_data; + using voronoi_diagram_type = boost::polygon::voronoi_diagram; class diagram_type : public voronoi_diagram_type @@ -75,9 +75,9 @@ namespace Path Base::Vector3d scaledVector(const point_type &p, double z) const; Base::Vector3d scaledVector(const vertex_type &v, double z) const; - typedef std::map cell_map_type; - typedef std::map edge_map_type; - typedef std::map vertex_map_type; + using cell_map_type = std::map; + using edge_map_type = std::map; + using vertex_map_type = std::map; int index(const cell_type *cell) const; int index(const edge_type *edge) const; @@ -91,7 +91,7 @@ namespace Path point_type retrievePoint(const cell_type *cell) const; segment_type retrieveSegment(const cell_type *cell) const; - typedef std::map angle_map_t; + using angle_map_t = std::map; double angleOfSegment(int i, angle_map_t *angle = nullptr) const; bool segmentsAreConnected(int i, int j) const; diff --git a/src/Mod/Path/App/VoronoiPyImp.cpp b/src/Mod/Path/App/VoronoiPyImp.cpp index 416f09b8f7..a724d4b4d1 100644 --- a/src/Mod/Path/App/VoronoiPyImp.cpp +++ b/src/Mod/Path/App/VoronoiPyImp.cpp @@ -167,8 +167,8 @@ Py::List VoronoiPy::getCells() const { return list; } -typedef std::map exterior_map_t; -typedef std::map > coordinate_map_t; +using exterior_map_t = std::map; +using coordinate_map_t = std::map >; #define VORONOI_USE_EXTERIOR_CACHE 1 diff --git a/src/Mod/Path/Gui/ViewProviderArea.h b/src/Mod/Path/Gui/ViewProviderArea.h index 7d0e295f99..7da299d4b5 100644 --- a/src/Mod/Path/Gui/ViewProviderArea.h +++ b/src/Mod/Path/Gui/ViewProviderArea.h @@ -51,7 +51,7 @@ public: virtual void dropObject(App::DocumentObject*); }; -typedef Gui::ViewProviderPythonFeatureT ViewProviderAreaPython; +using ViewProviderAreaPython = Gui::ViewProviderPythonFeatureT; class PathGuiExport ViewProviderAreaView : public PartGui::ViewProviderPlaneParametric @@ -74,7 +74,7 @@ public: virtual void dropObject(App::DocumentObject*); }; -typedef Gui::ViewProviderPythonFeatureT ViewProviderAreaViewPython; +using ViewProviderAreaViewPython = Gui::ViewProviderPythonFeatureT; } //namespace PathGui diff --git a/src/Mod/Path/Gui/ViewProviderPath.h b/src/Mod/Path/Gui/ViewProviderPath.h index 162ddfd1a0..caac1ef18e 100644 --- a/src/Mod/Path/Gui/ViewProviderPath.h +++ b/src/Mod/Path/Gui/ViewProviderPath.h @@ -47,7 +47,7 @@ class PathSelectionObserver; class PathGuiExport ViewProviderPath : public Gui::ViewProviderGeometryObject { PROPERTY_HEADER(PathGui::ViewProviderPath); - typedef ViewProviderGeometryObject inherited; + using inherited = ViewProviderGeometryObject; public: /// constructor. @@ -117,7 +117,7 @@ protected: }; - typedef Gui::ViewProviderPythonFeatureT ViewProviderPathPython; + using ViewProviderPathPython = Gui::ViewProviderPythonFeatureT; } //namespace PathGui diff --git a/src/Mod/Path/Gui/ViewProviderPathCompound.h b/src/Mod/Path/Gui/ViewProviderPathCompound.h index 044222092c..0930cf8b8e 100644 --- a/src/Mod/Path/Gui/ViewProviderPathCompound.h +++ b/src/Mod/Path/Gui/ViewProviderPathCompound.h @@ -48,7 +48,7 @@ protected: }; -typedef Gui::ViewProviderPythonFeatureT ViewProviderPathCompoundPython; +using ViewProviderPathCompoundPython = Gui::ViewProviderPythonFeatureT; } //namespace PathGui