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

This commit is contained in:
wmayer
2022-08-29 22:21:01 +02:00
parent 3e009e2693
commit 236b40ab65
10 changed files with 32 additions and 32 deletions

View File

@@ -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<gp_Pnt> Box;
using Box = bg::model::box<gp_Pnt>;
static bool getBBox(const TopoDS_Edge& e, Box& box) {
Bnd_Box bound;
@@ -616,7 +616,7 @@ struct WireJoiner {
}
};
typedef std::list<EdgeInfo> Edges;
using Edges = std::list<EdgeInfo>;
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<WireInfo> Wires;
typedef std::pair<Wires::iterator, size_t> RValue;
using Wires = std::list<WireInfo>;
using RValue = std::pair<Wires::iterator, size_t>;
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<RValue, RParameters, RGetter> RTree;
using RTree = bgi::rtree<RValue, RParameters, RGetter>;
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<Wires::iterator, size_t> RResults;
using RResults = std::map<Wires::iterator, size_t>;
struct GetWires {
Wires& wires;

View File

@@ -70,7 +70,7 @@ private:
bool myInited;
};
typedef App::FeaturePythonT<FeatureArea> FeatureAreaPython;
using FeatureAreaPython = App::FeaturePythonT<FeatureArea>;
class PathExport FeatureAreaView : public Part::Feature
{
@@ -92,7 +92,7 @@ public:
App::PropertyInteger SectionCount;
};
typedef App::FeaturePythonT<FeatureAreaView> FeatureAreaViewPython;
using FeatureAreaViewPython = App::FeaturePythonT<FeatureAreaView>;
} //namespace Path

View File

@@ -64,7 +64,7 @@ protected:
};
typedef App::FeaturePythonT<Feature> FeaturePython;
using FeaturePython = App::FeaturePythonT<Feature>;
} //namespace Path

View File

@@ -64,7 +64,7 @@ public:
};
typedef App::FeaturePythonT<FeatureCompound> FeatureCompoundPython;
using FeatureCompoundPython = App::FeaturePythonT<FeatureCompound>;
} //namespace Path

View File

@@ -72,7 +72,7 @@ protected:
};
typedef App::FeaturePythonT<FeatureShape> FeatureShapePython;
using FeatureShapePython = App::FeaturePythonT<FeatureShape>;
} //namespace Path

View File

@@ -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<double> vertex_type;
typedef boost::polygon::point_data<coordinate_type> point_type;
typedef boost::polygon::segment_data<coordinate_type> segment_type;
typedef boost::polygon::voronoi_diagram<double> voronoi_diagram_type;
using coordinate_type = double;
using vertex_type = boost::polygon::voronoi_vertex<double>;
using point_type = boost::polygon::point_data<coordinate_type>;
using segment_type = boost::polygon::segment_data<coordinate_type>;
using voronoi_diagram_type = boost::polygon::voronoi_diagram<double>;
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<intptr_t, int> cell_map_type;
typedef std::map<intptr_t, int> edge_map_type;
typedef std::map<intptr_t, int> vertex_map_type;
using cell_map_type = std::map<intptr_t, int>;
using edge_map_type = std::map<intptr_t, int>;
using vertex_map_type = std::map<intptr_t, int>;
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<int, double> angle_map_t;
using angle_map_t = std::map<int, double>;
double angleOfSegment(int i, angle_map_t *angle = nullptr) const;
bool segmentsAreConnected(int i, int j) const;

View File

@@ -167,8 +167,8 @@ Py::List VoronoiPy::getCells() const {
return list;
}
typedef std::map<uintptr_t,bool> exterior_map_t;
typedef std::map<int32_t, std::set<int32_t> > coordinate_map_t;
using exterior_map_t = std::map<uintptr_t,bool>;
using coordinate_map_t = std::map<int32_t, std::set<int32_t> >;
#define VORONOI_USE_EXTERIOR_CACHE 1

View File

@@ -51,7 +51,7 @@ public:
virtual void dropObject(App::DocumentObject*);
};
typedef Gui::ViewProviderPythonFeatureT<ViewProviderArea> ViewProviderAreaPython;
using ViewProviderAreaPython = Gui::ViewProviderPythonFeatureT<ViewProviderArea>;
class PathGuiExport ViewProviderAreaView : public PartGui::ViewProviderPlaneParametric
@@ -74,7 +74,7 @@ public:
virtual void dropObject(App::DocumentObject*);
};
typedef Gui::ViewProviderPythonFeatureT<ViewProviderAreaView> ViewProviderAreaViewPython;
using ViewProviderAreaViewPython = Gui::ViewProviderPythonFeatureT<ViewProviderAreaView>;
} //namespace PathGui

View File

@@ -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<ViewProviderPath> ViewProviderPathPython;
using ViewProviderPathPython = Gui::ViewProviderPythonFeatureT<ViewProviderPath>;
} //namespace PathGui

View File

@@ -48,7 +48,7 @@ protected:
};
typedef Gui::ViewProviderPythonFeatureT<ViewProviderPathCompound> ViewProviderPathCompoundPython;
using ViewProviderPathCompoundPython = Gui::ViewProviderPythonFeatureT<ViewProviderPathCompound>;
} //namespace PathGui