From ef59716bfab870d3193fa9670f2cacc3cca39595 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 17 Jan 2013 19:23:15 +0100 Subject: const methods (bzr r12037) --- src/live_effects/parameter/bool.h | 5 ++--- src/live_effects/parameter/enum.h | 5 +++-- src/live_effects/parameter/parameter.h | 5 ++--- src/live_effects/parameter/path.cpp | 2 +- src/live_effects/parameter/path.h | 2 +- src/live_effects/parameter/point.h | 2 +- src/live_effects/parameter/powerstrokepointarray.h | 6 +++--- src/live_effects/parameter/random.h | 3 +-- src/live_effects/parameter/text.h | 2 +- src/live_effects/parameter/unit.cpp | 2 +- src/live_effects/parameter/unit.h | 4 ++-- src/live_effects/parameter/vector.h | 2 +- 12 files changed, 19 insertions(+), 21 deletions(-) (limited to 'src/live_effects/parameter') diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h index d7aa299aa..fafb1beca 100644 --- a/src/live_effects/parameter/bool.h +++ b/src/live_effects/parameter/bool.h @@ -36,10 +36,9 @@ public: void param_setValue(bool newvalue); virtual void param_set_default(); - bool get_value() { return value; }; + bool get_value() const { return value; }; - inline operator bool() - { return value; }; + inline operator bool() const { return value; }; private: BoolParam(const BoolParam&); diff --git a/src/live_effects/parameter/enum.h b/src/live_effects/parameter/enum.h index 2a1b07b47..2340663c3 100644 --- a/src/live_effects/parameter/enum.h +++ b/src/live_effects/parameter/enum.h @@ -68,8 +68,9 @@ public: return value; } - inline operator E() - { return value; }; + inline operator E() const { + return value; + }; void param_set_default() { param_set_value(defvalue); diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index 4785d5455..526708ed7 100644 --- a/src/live_effects/parameter/parameter.h +++ b/src/live_effects/parameter/parameter.h @@ -59,7 +59,7 @@ public: virtual Glib::ustring * param_getTooltip() { return ¶m_tooltip; }; // overload these for your particular parameter to make it provide knotholder handles or canvas helperpaths - virtual bool providesKnotHolderEntities() { return false; } + virtual bool providesKnotHolderEntities() const { return false; } virtual void addKnotHolderEntities(KnotHolder */*knotholder*/, SPDesktop */*desktop*/, SPItem */*item*/) {}; virtual void addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector &/*hp_vec*/) {}; @@ -112,8 +112,7 @@ public: virtual Gtk::Widget * param_newWidget(); - inline operator gdouble() - { return value; }; + inline operator gdouble() const { return value; }; protected: gdouble value; diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index 1b3d7417d..d076cc5d0 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -77,7 +77,7 @@ PathParam::~PathParam() } std::vector const & -PathParam::get_pathvector() +PathParam::get_pathvector() const { return _pathvector; } diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h index a4f46f11f..d48b5422d 100644 --- a/src/live_effects/parameter/path.h +++ b/src/live_effects/parameter/path.h @@ -31,7 +31,7 @@ public: const gchar * default_value = "M0,0 L1,1"); virtual ~PathParam(); - std::vector const & get_pathvector(); + std::vector const & get_pathvector() const; Geom::Piecewise > const & get_pwd2(); virtual Gtk::Widget * param_newWidget(); diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h index f2397753e..319835bb3 100644 --- a/src/live_effects/parameter/point.h +++ b/src/live_effects/parameter/point.h @@ -47,7 +47,7 @@ public: void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color); - virtual bool providesKnotHolderEntities() { return true; } + virtual bool providesKnotHolderEntities() const { return true; } virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item); private: diff --git a/src/live_effects/parameter/powerstrokepointarray.h b/src/live_effects/parameter/powerstrokepointarray.h index 0e08d78fe..e1fa440f2 100644 --- a/src/live_effects/parameter/powerstrokepointarray.h +++ b/src/live_effects/parameter/powerstrokepointarray.h @@ -37,12 +37,12 @@ public: void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color); - virtual bool providesKnotHolderEntities() { return true; } + virtual bool providesKnotHolderEntities() const { return true; } virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item); void set_pwd2(Geom::Piecewise > const & pwd2_in, Geom::Piecewise > const & pwd2_normal_in); - Geom::Piecewise > const & get_pwd2() { return last_pwd2; } - Geom::Piecewise > const & get_pwd2_normal() { return last_pwd2_normal; } + Geom::Piecewise > const & get_pwd2() const { return last_pwd2; } + Geom::Piecewise > const & get_pwd2_normal() const { return last_pwd2_normal; } void recalculate_controlpoints_for_new_pwd2(Geom::Piecewise > const & pwd2_in); diff --git a/src/live_effects/parameter/random.h b/src/live_effects/parameter/random.h index b72f6f976..ca4440336 100644 --- a/src/live_effects/parameter/random.h +++ b/src/live_effects/parameter/random.h @@ -42,8 +42,7 @@ public: void resetRandomizer(); operator gdouble(); - inline gdouble get_value() - { return value; } ; + inline gdouble get_value() { return value; } ; protected: long startseed; diff --git a/src/live_effects/parameter/text.h b/src/live_effects/parameter/text.h index 85833885e..62de70eec 100644 --- a/src/live_effects/parameter/text.h +++ b/src/live_effects/parameter/text.h @@ -46,7 +46,7 @@ public: const double t, const double length, bool use_curvature = false); void setAnchor(double x_value, double y_value); - const Glib::ustring get_value() { return defvalue; }; + const Glib::ustring get_value() const { return defvalue; }; private: TextParam(const TextParam&); diff --git a/src/live_effects/parameter/unit.cpp b/src/live_effects/parameter/unit.cpp index 36b6efacc..7a2ce6f65 100644 --- a/src/live_effects/parameter/unit.cpp +++ b/src/live_effects/parameter/unit.cpp @@ -59,7 +59,7 @@ UnitParam::param_set_value(SPUnit const *val) } const gchar * -UnitParam::get_abbreviation() +UnitParam::get_abbreviation() const { return sp_unit_get_abbreviation(unit); } diff --git a/src/live_effects/parameter/unit.h b/src/live_effects/parameter/unit.h index 3d417fcd6..ea7a0112a 100644 --- a/src/live_effects/parameter/unit.h +++ b/src/live_effects/parameter/unit.h @@ -30,11 +30,11 @@ public: virtual gchar * param_getSVGValue() const; virtual void param_set_default(); void param_set_value(SPUnit const *val); - const gchar *get_abbreviation(); + const gchar *get_abbreviation() const; virtual Gtk::Widget * param_newWidget(); - operator SPUnit const *() { return unit; } + operator SPUnit const *() const { return unit; } private: SPUnit const *unit; diff --git a/src/live_effects/parameter/vector.h b/src/live_effects/parameter/vector.h index f82affe16..35ca04437 100644 --- a/src/live_effects/parameter/vector.h +++ b/src/live_effects/parameter/vector.h @@ -52,7 +52,7 @@ public: void set_origin_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color); void set_oncanvas_color(guint32 color); - virtual bool providesKnotHolderEntities() { return true; } + virtual bool providesKnotHolderEntities() const { return true; } virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item); private: -- cgit v1.2.3 From bf58d4cb9c86682d1416c64378d1cfc8a95554e8 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 17 Jan 2013 21:02:50 +0100 Subject: const .... (bzr r12039) --- src/live_effects/parameter/originalpath.h | 2 +- src/live_effects/parameter/parameter.h | 2 +- src/live_effects/parameter/path.cpp | 2 +- src/live_effects/parameter/path.h | 2 +- src/live_effects/parameter/point.cpp | 4 ++-- src/live_effects/parameter/powerstrokepointarray.cpp | 6 +++--- src/live_effects/parameter/vector.cpp | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/live_effects/parameter') diff --git a/src/live_effects/parameter/originalpath.h b/src/live_effects/parameter/originalpath.h index 7dd17edb0..b3feec41f 100644 --- a/src/live_effects/parameter/originalpath.h +++ b/src/live_effects/parameter/originalpath.h @@ -31,7 +31,7 @@ public: /** Disable the canvas indicators of parent class by overriding this method */ virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {}; /** Disable the canvas indicators of parent class by overriding this method */ - virtual void addCanvasIndicators(SPLPEItem * /*lpeitem*/, std::vector & /*hp_vec*/) {}; + virtual void addCanvasIndicators(SPLPEItem const* /*lpeitem*/, std::vector & /*hp_vec*/) {}; protected: virtual void linked_modified_callback(SPObject *linked_obj, guint flags); diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index 526708ed7..785ada92e 100644 --- a/src/live_effects/parameter/parameter.h +++ b/src/live_effects/parameter/parameter.h @@ -61,7 +61,7 @@ public: // overload these for your particular parameter to make it provide knotholder handles or canvas helperpaths virtual bool providesKnotHolderEntities() const { return false; } virtual void addKnotHolderEntities(KnotHolder */*knotholder*/, SPDesktop */*desktop*/, SPItem */*item*/) {}; - virtual void addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector &/*hp_vec*/) {}; + virtual void addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector &/*hp_vec*/) {}; virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {}; virtual void param_setup_nodepath(Inkscape::NodePath::Path */*np*/) {}; diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index d076cc5d0..eca0d7a22 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -231,7 +231,7 @@ PathParam::param_setup_nodepath(Inkscape::NodePath::Path *) } void -PathParam::addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector &hp_vec) +PathParam::addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector &hp_vec) { hp_vec.push_back(_pathvector); } diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h index d48b5422d..112a1ea13 100644 --- a/src/live_effects/parameter/path.h +++ b/src/live_effects/parameter/path.h @@ -46,7 +46,7 @@ public: virtual void param_editOncanvas(SPItem * item, SPDesktop * dt); virtual void param_setup_nodepath(Inkscape::NodePath::Path *np); - virtual void addCanvasIndicators(SPLPEItem *lpeitem, std::vector &hp_vec); + virtual void addCanvasIndicators(SPLPEItem const* lpeitem, std::vector &hp_vec); virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/); diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 2be87e048..53866f278 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -133,7 +133,7 @@ public: virtual ~PointParamKnotHolderEntity() {} virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual Geom::Point knot_get(); + virtual Geom::Point knot_get() const; virtual void knot_click(guint state); private: @@ -149,7 +149,7 @@ PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/* } Geom::Point -PointParamKnotHolderEntity::knot_get() +PointParamKnotHolderEntity::knot_get() const { return *pparam; } diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp index 93161ec0d..fecdfeda8 100644 --- a/src/live_effects/parameter/powerstrokepointarray.cpp +++ b/src/live_effects/parameter/powerstrokepointarray.cpp @@ -124,11 +124,11 @@ public: virtual ~PowerStrokePointArrayParamKnotHolderEntity() {} virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual Geom::Point knot_get(); + virtual Geom::Point knot_get() const; virtual void knot_click(guint state); /** Checks whether the index falls within the size of the parameter's vector */ - bool valid_index(unsigned int index) { + bool valid_index(unsigned int index) const { return (_pparam->_vector.size() > index); }; @@ -164,7 +164,7 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom: } Geom::Point -PowerStrokePointArrayParamKnotHolderEntity::knot_get() +PowerStrokePointArrayParamKnotHolderEntity::knot_get() const { using namespace Geom; diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp index a20c46042..edd6b863f 100644 --- a/src/live_effects/parameter/vector.cpp +++ b/src/live_effects/parameter/vector.cpp @@ -154,7 +154,7 @@ public: param->setOrigin(s); sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false); }; - virtual Geom::Point knot_get(){ + virtual Geom::Point knot_get() const { return param->origin; }; virtual void knot_click(guint /*state*/){ @@ -176,7 +176,7 @@ public: param->setVector(s); sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false); }; - virtual Geom::Point knot_get(){ + virtual Geom::Point knot_get() const { return param->origin + param->vector; }; virtual void knot_click(guint /*state*/){ -- cgit v1.2.3