diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-05-01 18:19:32 +0200 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-05-01 18:19:32 +0200 |
| commit | 01b25accba1a5329e220aa647255d2c2b284c16e (patch) | |
| tree | 85fe233359934295830ee7b109d0cbb908a7d66a /src/Model/Elements | |
| parent | 40d48a2d4f477beec0e387114f4335ab1aab1ab6 (diff) | |
Add operator overload squeleton
Diffstat (limited to 'src/Model/Elements')
| -rw-r--r-- | src/Model/Elements/StringElement.cpp | 25 | ||||
| -rw-r--r-- | src/Model/Elements/StringElement.hpp | 3 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/Model/Elements/StringElement.cpp b/src/Model/Elements/StringElement.cpp index f93fe3b..fbf57c1 100644 --- a/src/Model/Elements/StringElement.cpp +++ b/src/Model/Elements/StringElement.cpp @@ -2,7 +2,7 @@ StringElement::StringElement(){ - this->m_value="."; + this->m_value=""; } StringElement::~StringElement(){ @@ -20,5 +20,28 @@ void StringElement::setValue(std::string value){ } std::string StringElement::description(){ + if(this->m_value==""){ + return " "; + } return this->m_value; } + +bool StringElement::isEmpty(){ + if(this->m_value==""){ + return true; + } + + return false; +} +bool StringElement::equals(StringElement const& element) const{ + if(this->m_value.compare(element.m_value) == 0){ + return true; + } + + return true; +} + +bool operator==(StringElement const& a, StringElement const& b){ + return a.equals(b); +} + diff --git a/src/Model/Elements/StringElement.hpp b/src/Model/Elements/StringElement.hpp index db40f58..16946a8 100644 --- a/src/Model/Elements/StringElement.hpp +++ b/src/Model/Elements/StringElement.hpp @@ -20,7 +20,10 @@ class StringElement std::string getValue(); void setValue(std::string value); + bool isEmpty(); + bool equals(StringElement const& element) const; std::string description(); + }; #endif |
