Style fix: const for some functions

This commit is contained in:
ntfshard 2015-07-28 02:26:01 +03:00 committed by Alessandro Ranellucci
parent f2c4a66e45
commit eb7464ace6
10 changed files with 51 additions and 51 deletions

View file

@ -1514,7 +1514,7 @@ void Clipper::DisposeOutRec(PolyOutList::size_type index)
}
//------------------------------------------------------------------------------
void Clipper::SetWindingCount(TEdge &edge)
void Clipper::SetWindingCount(TEdge &edge) const
{
TEdge *e = edge.PrevInAEL;
//find the edge of the same polytype that immediately preceeds 'edge' in AEL
@ -2180,7 +2180,7 @@ void Clipper::IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &Pt)
}
//------------------------------------------------------------------------------
void Clipper::SetHoleState(TEdge *e, OutRec *outrec)
void Clipper::SetHoleState(TEdge *e, OutRec *outrec) const
{
bool IsHole = false;
TEdge *e2 = e->PrevInAEL;
@ -2238,7 +2238,7 @@ OutRec* Clipper::GetOutRec(int Idx)
}
//------------------------------------------------------------------------------
void Clipper::AppendPolygon(TEdge *e1, TEdge *e2)
void Clipper::AppendPolygon(TEdge *e1, TEdge *e2) const
{
//get the start and ends of both output polygons ...
OutRec *outRec1 = m_PolyOuts[e1->OutIdx];
@ -3576,7 +3576,7 @@ static OutRec* ParseFirstLeft(OutRec* FirstLeft)
}
//------------------------------------------------------------------------------
void Clipper::FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec)
void Clipper::FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec) const
{
//tests if NewOutRec contains the polygon before reassigning FirstLeft
for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
@ -3593,7 +3593,7 @@ void Clipper::FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec)
}
//----------------------------------------------------------------------
void Clipper::FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec)
void Clipper::FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec) const
{
//reassigns FirstLeft WITHOUT testing if NewOutRec contains the polygon
for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)

View file

@ -224,7 +224,7 @@ public:
bool AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed);
virtual void Clear();
IntRect GetBounds();
bool PreserveCollinear() {return m_PreserveCollinear;};
bool PreserveCollinear() const {return m_PreserveCollinear;};
void PreserveCollinear(bool value) {m_PreserveCollinear = value;};
protected:
void DisposeLocalMinimaList();
@ -265,9 +265,9 @@ public:
PolyTree &polytree,
PolyFillType subjFillType,
PolyFillType clipFillType);
bool ReverseSolution() { return m_ReverseOutput; };
bool ReverseSolution() const { return m_ReverseOutput; };
void ReverseSolution(bool value) {m_ReverseOutput = value;};
bool StrictlySimple() {return m_StrictSimple;};
bool StrictlySimple() const {return m_StrictSimple;};
void StrictlySimple(bool value) {m_StrictSimple = value;};
//set the callback function for z value filling on intersections (otherwise Z is 0)
#ifdef use_xyz
@ -297,7 +297,7 @@ private:
#ifdef use_xyz
ZFillCallback m_ZFill; //custom callback
#endif
void SetWindingCount(TEdge& edge);
void SetWindingCount(TEdge& edge) const;
bool IsEvenOddFillType(const TEdge& edge) const;
bool IsEvenOddAltFillType(const TEdge& edge) const;
void InsertScanbeam(const cInt Y);
@ -319,7 +319,7 @@ private:
void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
OutPt* AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
OutRec* GetOutRec(int idx);
void AppendPolygon(TEdge *e1, TEdge *e2);
void AppendPolygon(TEdge *e1, TEdge *e2) const;
void IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &pt);
OutRec* CreateOutRec();
OutPt* AddOutPt(TEdge *e, const IntPoint &pt);
@ -332,7 +332,7 @@ private:
void ProcessEdgesAtTopOfScanbeam(const cInt topY);
void BuildResult(Paths& polys);
void BuildResult2(PolyTree& polytree);
void SetHoleState(TEdge *e, OutRec *outrec);
void SetHoleState(TEdge *e, OutRec *outrec) const;
void DisposeIntersectNodes();
bool FixupIntersectionOrder();
void FixupOutPolygon(OutRec &outrec);
@ -347,8 +347,8 @@ private:
bool JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2);
void JoinCommonEdges();
void DoSimplePolygons();
void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec);
void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec);
void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec) const;
void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec) const;
#ifdef use_xyz
void SetZ(IntPoint& pt, TEdge& e1, TEdge& e2);
#endif

View file

@ -67,7 +67,7 @@ GCodeWriter::preamble()
}
std::string
GCodeWriter::postamble()
GCodeWriter::postamble() const
{
std::ostringstream gcode;
if (FLAVOR_IS(gcfMachinekit))
@ -76,7 +76,7 @@ GCodeWriter::postamble()
}
std::string
GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool)
GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) const
{
if (wait && (FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish)))
return "";
@ -110,7 +110,7 @@ GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool)
}
std::string
GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait)
GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait) const
{
std::string code, comment;
if (wait && FLAVOR_IS_NOT(gcfTeacup)) {
@ -217,7 +217,7 @@ GCodeWriter::reset_e(bool force)
}
std::string
GCodeWriter::update_progress(unsigned int num, unsigned int tot, bool allow_100)
GCodeWriter::update_progress(unsigned int num, unsigned int tot, bool allow_100) const
{
if (FLAVOR_IS_NOT(gcfMakerWare) && FLAVOR_IS_NOT(gcfSailfish))
return "";
@ -273,7 +273,7 @@ GCodeWriter::toolchange(unsigned int extruder_id)
}
std::string
GCodeWriter::set_speed(double F, const std::string &comment)
GCodeWriter::set_speed(double F, const std::string &comment) const
{
std::ostringstream gcode;
gcode << "G1 F" << F;

View file

@ -24,17 +24,17 @@ class GCodeWriter {
void apply_print_config(const PrintConfig &print_config);
void set_extruders(const std::vector<unsigned int> &extruder_ids);
std::string preamble();
std::string postamble();
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1);
std::string set_bed_temperature(unsigned int temperature, bool wait = false);
std::string postamble() const;
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const;
std::string set_bed_temperature(unsigned int temperature, bool wait = false) const;
std::string set_fan(unsigned int speed, bool dont_save = false);
std::string set_acceleration(unsigned int acceleration);
std::string reset_e(bool force = false);
std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false);
std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false) const;
bool need_toolchange(unsigned int extruder_id) const;
std::string set_extruder(unsigned int extruder_id);
std::string toolchange(unsigned int extruder_id);
std::string set_speed(double F, const std::string &comment = std::string());
std::string set_speed(double F, const std::string &comment = std::string()) const;
std::string travel_to_xy(const Pointf &point, const std::string &comment = std::string());
std::string travel_to_xyz(const Pointf3 &point, const std::string &comment = std::string());
std::string travel_to_z(double z, const std::string &comment = std::string());

View file

@ -61,7 +61,7 @@ Layer::object() const
size_t
Layer::region_count()
Layer::region_count() const
{
return this->regions.size();
}

View file

@ -93,7 +93,7 @@ class Layer {
ExPolygonCollection slices;
size_t region_count();
size_t region_count() const;
LayerRegion* get_region(int idx);
LayerRegion* add_region(PrintRegion* print_region);

View file

@ -150,7 +150,7 @@ void Triangle::Legalize(Point& opoint, Point& npoint)
}
}
int Triangle::Index(const Point* p)
int Triangle::Index(const Point* p) const
{
if (p == points_[0]) {
return 0;
@ -163,7 +163,7 @@ int Triangle::Index(const Point* p)
return -1;
}
int Triangle::EdgeIndex(const Point* p1, const Point* p2)
int Triangle::EdgeIndex(const Point* p1, const Point* p2) const
{
if (points_[0] == p1) {
if (points_[1] == p2) {
@ -259,7 +259,7 @@ Triangle* Triangle::NeighborCCW(const Point& point)
return neighbors_[1];
}
bool Triangle::GetConstrainedEdgeCCW(const Point& p)
bool Triangle::GetConstrainedEdgeCCW(const Point& p) const
{
if (&p == points_[0]) {
return constrained_edge[2];
@ -269,7 +269,7 @@ bool Triangle::GetConstrainedEdgeCCW(const Point& p)
return constrained_edge[1];
}
bool Triangle::GetConstrainedEdgeCW(const Point& p)
bool Triangle::GetConstrainedEdgeCW(const Point& p) const
{
if (&p == points_[0]) {
return constrained_edge[1];
@ -301,7 +301,7 @@ void Triangle::SetConstrainedEdgeCW(const Point& p, bool ce)
}
}
bool Triangle::GetDelunayEdgeCCW(const Point& p)
bool Triangle::GetDelunayEdgeCCW(const Point& p) const
{
if (&p == points_[0]) {
return delaunay_edge[2];
@ -311,7 +311,7 @@ bool Triangle::GetDelunayEdgeCCW(const Point& p)
return delaunay_edge[1];
}
bool Triangle::GetDelunayEdgeCW(const Point& p)
bool Triangle::GetDelunayEdgeCW(const Point& p) const
{
if (&p == points_[0]) {
return delaunay_edge[1];

View file

@ -171,23 +171,23 @@ void MarkConstrainedEdge(int index);
void MarkConstrainedEdge(Edge& edge);
void MarkConstrainedEdge(Point* p, Point* q);
int Index(const Point* p);
int EdgeIndex(const Point* p1, const Point* p2);
int Index(const Point* p) const;
int EdgeIndex(const Point* p1, const Point* p2) const;
Triangle* NeighborCW(const Point& point);
Triangle* NeighborCCW(const Point& point);
bool GetConstrainedEdgeCCW(const Point& p);
bool GetConstrainedEdgeCW(const Point& p);
bool GetConstrainedEdgeCCW(const Point& p) const;
bool GetConstrainedEdgeCW(const Point& p) const;
void SetConstrainedEdgeCCW(const Point& p, bool ce);
void SetConstrainedEdgeCW(const Point& p, bool ce);
bool GetDelunayEdgeCCW(const Point& p);
bool GetDelunayEdgeCW(const Point& p);
bool GetDelunayEdgeCCW(const Point& p) const;
bool GetDelunayEdgeCW(const Point& p) const;
void SetDelunayEdgeCCW(const Point& p, bool e);
void SetDelunayEdgeCW(const Point& p, bool e);
bool Contains(const Point* p);
bool Contains(const Edge& e);
bool Contains(const Point* p, const Point* q);
bool Contains(const Point* p) const;
bool Contains(const Edge& e) const;
bool Contains(const Point* p, const Point* q) const;
void Legalize(Point& point);
void Legalize(Point& opoint, Point& npoint);
/**
@ -198,7 +198,7 @@ void ClearNeighbor(const Triangle *triangle);
void ClearNeighbors();
void ClearDelunayEdges();
inline bool IsInterior();
inline bool IsInterior() const;
inline void IsInterior(bool b);
Triangle& NeighborAcross(const Point& opoint);
@ -293,22 +293,22 @@ inline Triangle* Triangle::GetNeighbor(int index)
return neighbors_[index];
}
inline bool Triangle::Contains(const Point* p)
inline bool Triangle::Contains(const Point* p) const
{
return p == points_[0] || p == points_[1] || p == points_[2];
}
inline bool Triangle::Contains(const Edge& e)
inline bool Triangle::Contains(const Edge& e) const
{
return Contains(e.p) && Contains(e.q);
}
inline bool Triangle::Contains(const Point* p, const Point* q)
inline bool Triangle::Contains(const Point* p, const Point* q) const
{
return Contains(p) && Contains(q);
}
inline bool Triangle::IsInterior()
inline bool Triangle::IsInterior() const
{
return interior_;
}

View file

@ -82,7 +82,7 @@ TPPLPoly& TPPLPoly::operator=(const TPPLPoly &src) {
return *this;
}
int TPPLPoly::GetOrientation() {
int TPPLPoly::GetOrientation() const {
long i1,i2;
tppl_float area = 0;
for(i1=0; i1<numpoints; i1++) {
@ -1373,7 +1373,7 @@ bool TPPLPartition::Below(TPPLPoint &p1, TPPLPoint &p2) {
}
//sorts in the falling order of y values, if y is equal, x is used instead
bool TPPLPartition::VertexSorter::operator() (long index1, long index2) {
bool TPPLPartition::VertexSorter::operator() (long index1, long index2) const {
if(vertices[index1].p.y > vertices[index2].p.y) return true;
else if(vertices[index1].p.y == vertices[index2].p.y) {
if(vertices[index1].p.x > vertices[index2].p.x) return true;

View file

@ -89,11 +89,11 @@ public:
TPPLPoly& operator=(const TPPLPoly &src);
//getters and setters
long GetNumPoints() {
long GetNumPoints() const {
return numpoints;
}
bool IsHole() {
bool IsHole() const {
return hole;
}
@ -130,7 +130,7 @@ public:
// TPPL_CCW : polygon vertices are in counter-clockwise order
// TPPL_CW : polygon vertices are in clockwise order
// 0 : the polygon has no (measurable) area
int GetOrientation();
int GetOrientation() const;
//sets the polygon orientation
//orientation can be
@ -162,7 +162,7 @@ protected:
MonotoneVertex *vertices;
public:
VertexSorter(MonotoneVertex *v) : vertices(v) {}
bool operator() (long index1, long index2);
bool operator() (long index1, long index2) const;
};
struct Diagonal {