diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2017-01-15 18:45:15 +0100 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2017-01-15 18:45:15 +0100 |
commit | 716aadc00c1a03e43c246a72be4758fcdf809fe0 (patch) | |
tree | 7ea8584217a4239148463e82fae580da5f72163a /tikzit/graphelementproperty.cpp | |
parent | 3947a6b0fd38af964f5a09bd919d5d7f317697db (diff) |
working on parser
Diffstat (limited to 'tikzit/graphelementproperty.cpp')
-rw-r--r-- | tikzit/graphelementproperty.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tikzit/graphelementproperty.cpp b/tikzit/graphelementproperty.cpp new file mode 100644 index 0000000..7602b1c --- /dev/null +++ b/tikzit/graphelementproperty.cpp @@ -0,0 +1,34 @@ +#include "graphelementproperty.h" + +GraphElementProperty::GraphElementProperty(QString key, QString value, + bool atom, bool keyMatch, QObject *parent) : + QObject(parent), _key(key), _value(value), _atom(atom), _keyMatch(keyMatch) +{} + +GraphElementProperty::GraphElementProperty(QString key, QString value, QObject *parent) : + QObject(parent), _key(key), _value(value), _atom(false), _keyMatch(false) +{} + +GraphElementProperty::GraphElementProperty(QString key, QObject *parent) : + QObject(parent), _key(key), _value(""), _atom(true), _keyMatch(false) +{} + +QString GraphElementProperty::key() const +{ return _key; } + +QString GraphElementProperty::value() const +{ return _value; } + +bool GraphElementProperty::atom() const +{ return _atom; } + +bool GraphElementProperty::keyMatch() const +{ return _keyMatch; } + +bool GraphElementProperty::matches(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(); +} |