diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2018-01-04 16:00:52 +0100 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2018-01-04 16:00:52 +0100 |
commit | 738ecbd5fad2b46836bfd6a94aeebf165ae2bbca (patch) | |
tree | df04709807cc9ec8481a3ebc7d80ac25e5b2f457 /tikzit/src/data/graphelementproperty.cpp | |
parent | 0421a96749743868554d44585050b1b3d04864d2 (diff) |
relocated source code to the root
Diffstat (limited to 'tikzit/src/data/graphelementproperty.cpp')
-rw-r--r-- | tikzit/src/data/graphelementproperty.cpp | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/tikzit/src/data/graphelementproperty.cpp b/tikzit/src/data/graphelementproperty.cpp deleted file mode 100644 index a50af58..0000000 --- a/tikzit/src/data/graphelementproperty.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "graphelementproperty.h" - -#include <QRegExp> - -GraphElementProperty::GraphElementProperty (): - _key(""), _value(""), _atom(false), _keyMatch(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) : - _key(key), _value(value), _atom(false), _keyMatch(false) -{} - -GraphElementProperty::GraphElementProperty(QString key, bool keyMatch) : - _key(key), _value(""), _atom(!keyMatch), _keyMatch(keyMatch) -{} - -QString GraphElementProperty::key() const -{ return _key; } - -QString GraphElementProperty::value() const -{ return _value; } - -void GraphElementProperty::setValue(const QString &value) -{ _value = 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); -} - -QString GraphElementProperty::tikzEscape(QString str) -{ - QRegExp re("[0-9a-zA-Z<> \\-'.]*"); - if (re.exactMatch(str)) return str; - else return "{" + str + "}"; -} - -QString GraphElementProperty::tikz() { - if (_atom) return tikzEscape(_key); - return tikzEscape(_key) + "=" + tikzEscape(_value); -} |