From 9b76357c1f374b423cd350d2923048003dbc71ac Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Thu, 24 Apr 2014 22:50:30 +0200
Subject: [PATCH] add operator !=

---
 alib2/src/string/CyclicString.cpp | 4 ++++
 alib2/src/string/CyclicString.h   | 2 ++
 alib2/src/string/Epsilon.cpp      | 6 ++++++
 alib2/src/string/Epsilon.h        | 4 ++++
 alib2/src/string/String.cpp       | 4 ++++
 alib2/src/string/String.h         | 5 +++--
 6 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/alib2/src/string/CyclicString.cpp b/alib2/src/string/CyclicString.cpp
index 662d6d132c..9317a681ea 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 9aa941be0a..2db7f39cdc 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 2788155acb..d758e43730 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 80d6a51615..6eb628e13a 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 a79b2db48e..013fc6f00c 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 0438910c86..436163210b 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 */
-- 
GitLab