From 7308f9e1e734fc54661b3d79c4ff8e8fbeb84867 Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Sun, 3 Nov 2019 20:02:46 +0100 Subject: refactor: Eliminate SPIString::value_default - eliminate value_default - make value private (-> _value) - add value() method --- src/object/sp-path.cpp | 4 ++-- src/object/sp-shape.cpp | 6 +++--- src/object/sp-text.cpp | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/object') diff --git a/src/object/sp-path.cpp b/src/object/sp-path.cpp index 9d7ef1fe0..58a823543 100644 --- a/src/object/sp-path.cpp +++ b/src/object/sp-path.cpp @@ -133,14 +133,14 @@ void SPPath::build(SPDocument *document, Inkscape::XML::Node *repr) { (d_source == SP_STYLE_SRC_STYLE_PROP || d_source == SP_STYLE_SRC_STYLE_SHEET) ) { - if (style->d.value) { + if (char const *d_val = style->d.value()) { // Chrome shipped with a different syntax for property vs attribute. // The SVG Working group decided to follow the Chrome syntax (which may // allow future extensions of the 'd' property). The property syntax // wraps the path data with "path(...)". We must strip that! // Must be Glib::ustring or we get conversion errors! - Glib::ustring input = style->d.value; + Glib::ustring input = d_val; Glib::ustring expression = R"A(path\("(.*)"\))A"; Glib::RefPtr regex = Glib::Regex::create(expression); Glib::MatchInfo matchInfo; diff --git a/src/object/sp-shape.cpp b/src/object/sp-shape.cpp index be68aae1f..c342fba85 100644 --- a/src/object/sp-shape.cpp +++ b/src/object/sp-shape.cpp @@ -67,7 +67,7 @@ void SPShape::build(SPDocument *document, Inkscape::XML::Node *repr) { SPLPEItem::build(document, repr); for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) { - sp_shape_set_marker (this, i, this->style->marker_ptrs[i]->value); + sp_shape_set_marker (this, i, this->style->marker_ptrs[i]->value()); } } @@ -133,7 +133,7 @@ void SPShape::update(SPCtx* ctx, guint flags) { * match the style. */ for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) { - sp_shape_set_marker (this, i, this->style->marker_ptrs[i]->value); + sp_shape_set_marker (this, i, this->style->marker_ptrs[i]->value()); } if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -856,7 +856,7 @@ Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /* * match the style. */ for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) { - sp_shape_set_marker (this, i, this->style->marker_ptrs[i]->value); + sp_shape_set_marker (this, i, this->style->marker_ptrs[i]->value()); } if (has_markers) { diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp index 3cfae54cb..714ebe1d2 100644 --- a/src/object/sp-text.cpp +++ b/src/object/sp-text.cpp @@ -352,7 +352,7 @@ gchar* SPText::description() const { SPStyle *style = this->style; - char *n = xml_quote_strdup( style->font_family.value ); + char *n = xml_quote_strdup(style->font_family.value()); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT); @@ -1024,7 +1024,7 @@ Inkscape::XML::Node* SPText::get_first_rectangle() Inkscape::XML::Node *our_ref = getRepr(); - if (style->shape_inside.set && style->shape_inside.value) { + if (style->shape_inside.set) { std::vector shapes = get_shapes(); @@ -1047,11 +1047,11 @@ Inkscape::XML::Node* SPText::get_first_rectangle() std::vector SPText::get_shapes() const { std::vector shapes; - if (style->shape_inside.set && style->shape_inside.value) { - + char const *val; + if (style->shape_inside.set && (val = style->shape_inside.value())) { static Glib::RefPtr regex = Glib::Regex::create("url\\(#([A-z0-9#]*)\\)"); Glib::MatchInfo matchInfo; - regex->match(style->shape_inside.value, matchInfo); + regex->match(val, matchInfo); while (matchInfo.matches()) { shapes.push_back(matchInfo.fetch(1)); -- cgit v1.2.3