summaryrefslogtreecommitdiffstats
path: root/src/util/units.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2013-07-24 22:29:24 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2013-07-24 22:29:24 +0000
commit13da86a85b5366284166ec5b0f1ae84de30de182 (patch)
treea954c8f7705e963b11f2e12d06c17de61948a659 /src/util/units.cpp
parentRemove the "simple SAX" parser. Replace its only use (loading of unit (diff)
downloadinkscape-13da86a85b5366284166ec5b0f1ae84de30de182.tar.gz
inkscape-13da86a85b5366284166ec5b0f1ae84de30de182.zip
Remove unnecessary variable from the GMarkup-based unit parser
(bzr r12439)
Diffstat (limited to 'src/util/units.cpp')
-rw-r--r--src/util/units.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/util/units.cpp b/src/util/units.cpp
index 757d05ffe..f8ebc5c1a 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -62,8 +62,6 @@ protected:
virtual void on_end_element(Ctx &ctx, Glib::ustring const &name);
virtual void on_text(Ctx &ctx, Glib::ustring const &text);
- Glib::ustring _current_element;
-
public:
UnitTable *tbl;
bool primary;
@@ -212,7 +210,6 @@ bool UnitTable::save(std::string const &filename) {
void UnitParser::on_start_element(Ctx &ctx, Glib::ustring const &name, AttrMap const &attrs)
{
- _current_element = name;
if (name == "unit") {
// reset for next use
unit.clear();
@@ -237,16 +234,17 @@ void UnitParser::on_start_element(Ctx &ctx, Glib::ustring const &name, AttrMap c
void UnitParser::on_text(Ctx &ctx, Glib::ustring const &text)
{
- if (_current_element == "name") {
+ Glib::ustring element = ctx.get_element();
+ if (element == "name") {
unit.name = text;
- } else if (_current_element == "plural") {
+ } else if (element == "plural") {
unit.name_plural = text;
- } else if (_current_element == "abbr") {
+ } else if (element == "abbr") {
unit.abbr = text;
- } else if (_current_element == "factor") {
+ } else if (element == "factor") {
// TODO make sure we use the right conversion
unit.factor = g_ascii_strtod(text.c_str(), NULL);
- } else if (_current_element == "description") {
+ } else if (element == "description") {
unit.description = text;
}
}