From ea4fffa590b1bf7cb936cf6e5ab4e8090dc38910 Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Tue, 21 Aug 2018 16:49:59 +0200 Subject: style categories --- src/data/graphelementproperty.cpp | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'src/data/graphelementproperty.cpp') diff --git a/src/data/graphelementproperty.cpp b/src/data/graphelementproperty.cpp index 79a8280..aa1bfc8 100644 --- a/src/data/graphelementproperty.cpp +++ b/src/data/graphelementproperty.cpp @@ -21,19 +21,19 @@ #include GraphElementProperty::GraphElementProperty (): - _key(""), _value(""), _atom(false), _keyMatch(false) + _key(""), _value(""), _atom(false) {} -GraphElementProperty::GraphElementProperty(QString key, QString value, bool atom, bool keyMatch) : - _key(key), _value(value), _atom(atom), _keyMatch(keyMatch) +GraphElementProperty::GraphElementProperty(QString key, QString value, bool atom) : + _key(key), _value(value), _atom(atom) {} GraphElementProperty::GraphElementProperty(QString key, QString value) : - _key(key), _value(value), _atom(false), _keyMatch(false) + _key(key), _value(value), _atom(false) {} -GraphElementProperty::GraphElementProperty(QString key, bool keyMatch) : - _key(key), _value(""), _atom(!keyMatch), _keyMatch(keyMatch) +GraphElementProperty::GraphElementProperty(QString key) : + _key(key), _value(""), _atom(true) {} QString GraphElementProperty::key() const @@ -48,20 +48,11 @@ void GraphElementProperty::setValue(const QString &value) bool GraphElementProperty::atom() const { return _atom; } -bool GraphElementProperty::keyMatch() const -{ return _keyMatch; } - -bool GraphElementProperty::matches(const GraphElementProperty &p) -{ - if (p.atom()) return _atom && _key == p.key(); - if (p.keyMatch()) return !_atom && _key == p.key(); - if (_keyMatch) return !p.atom() && _key == p.key(); - return !_atom && _key == p.key() && _value == p.value(); -} bool GraphElementProperty::operator==(const GraphElementProperty &p) { - return matches(p); + if (_atom) return p.atom() && p.key() == _key; + else return !p.atom() && p.key() == _key && p.value() == _value; } QString GraphElementProperty::tikzEscape(QString str) @@ -75,3 +66,8 @@ QString GraphElementProperty::tikz() { if (_atom) return tikzEscape(_key); return tikzEscape(_key) + "=" + tikzEscape(_value); } + +void GraphElementProperty::setKey(const QString &key) +{ + _key = key; +} -- cgit v1.2.3