diff --git a/alib2/src/string/CyclicString.cpp b/alib2/src/string/CyclicString.cpp index 662d6d132c1eef6310c51d7ff7e9114734beb794..9317a681ea3ed43c36de68329857e640ea1f9255 100644 --- a/alib2/src/string/CyclicString.cpp +++ b/alib2/src/string/CyclicString.cpp @@ -41,6 +41,10 @@ bool CyclicString::operator==(const CyclicString& other) const { return m_Data == other.m_Data; } +bool CyclicString::operator!=(const CyclicString& other) const { + return !(*this == other); +} + std::ostream& operator <<(std::ostream& out, const CyclicString& string) { if(string.isEmpty()) { out << "(Epsilon)"; diff --git a/alib2/src/string/CyclicString.h b/alib2/src/string/CyclicString.h index 9aa941be0a1ab36dbb9bf1c6c622b625059e935c..2db7f39cdc750746372988e62d7b0647db4a5811 100644 --- a/alib2/src/string/CyclicString.h +++ b/alib2/src/string/CyclicString.h @@ -47,6 +47,8 @@ public: bool operator<(const CyclicString& other) const; bool operator==(const CyclicString& other) const; + + bool operator!=(const CyclicString& other) const; /** * Prints XML representation of the CyclicString to the output stream. diff --git a/alib2/src/string/Epsilon.cpp b/alib2/src/string/Epsilon.cpp index 2788155acb88eb3c50f4af0e48558d4fac4d26b1..d758e437305cadb53d78bdd7d03353348e62497a 100644 --- a/alib2/src/string/Epsilon.cpp +++ b/alib2/src/string/Epsilon.cpp @@ -21,4 +21,10 @@ bool Epsilon::operator==(const Epsilon& other) const { return true; } +bool Epsilon::operator!=(const Epsilon& other) const { + return false; +} + +Epsilon Epsilon::EPSILON = Epsilon(); + } /* namespace string */ diff --git a/alib2/src/string/Epsilon.h b/alib2/src/string/Epsilon.h index 80d6a516154dc474749cfc1bcfd73c01e4a05bb7..6eb628e13a5f14a56458e2892e4fb35367d4a4f8 100644 --- a/alib2/src/string/Epsilon.h +++ b/alib2/src/string/Epsilon.h @@ -30,6 +30,10 @@ public: bool operator<(const Epsilon& other) const; bool operator==(const Epsilon& other) const; + + bool operator!=(const Epsilon& other) const; + + static Epsilon EPSILON; }; } /* namespace string */ diff --git a/alib2/src/string/String.cpp b/alib2/src/string/String.cpp index a79b2db48e9dd68ff819848f0b326d9d15c63756..013fc6f00c0e30b8afb33cc140dccf225155bef9 100644 --- a/alib2/src/string/String.cpp +++ b/alib2/src/string/String.cpp @@ -41,6 +41,10 @@ bool String::operator==(const String& other) const { return m_Data == other.m_Data; } +bool String::operator!=(const String& other) const { + return !(*this == other); +} + std::ostream& operator <<(std::ostream& out, const String& string) { if(string.isEmpty()) { out << "(Epsilon)"; diff --git a/alib2/src/string/String.h b/alib2/src/string/String.h index 0438910c86b5e87f3b23763d6cbd81923fa62f57..436163210bb0229786d3bf989a29939d6450d2c0 100644 --- a/alib2/src/string/String.h +++ b/alib2/src/string/String.h @@ -45,8 +45,10 @@ public: bool isEmpty() const; bool operator<(const String& other) const; - + bool operator==(const String& other) const; + + bool operator!=(const String& other) const; /** * Prints XML representation of the String to the output stream. @@ -54,7 +56,6 @@ public: * @param string String to print */ friend std::ostream& operator<<(std::ostream& out, const String& string); - }; } /* namespace string */