From b2f655e34e597eea57e3b7904f14fcaac8d41b63 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Sat, 6 Feb 2021 18:36:05 +0100
Subject: [PATCH] Added const qualifier to operator ==

---
 common/include/utf8string.hpp | 8 ++++----
 common/src/utf8string.cpp     | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/common/include/utf8string.hpp b/common/include/utf8string.hpp
index 1b56bba..005bd58 100644
--- a/common/include/utf8string.hpp
+++ b/common/include/utf8string.hpp
@@ -18,9 +18,9 @@ class utf8char : public std::array<char, 4>
   utf8char(const char * other);
   utf8char & operator=(char other);
   utf8char & operator=(const std::string & other);
-  bool operator==(char other);
-  bool operator==(const std::string & other);
-  bool operator!=(char other);
+  bool operator==(char other) const;
+  bool operator==(const std::string & other) const;
+  bool operator!=(char other) const;
 };
 
 class utf8string : public std::vector<utf8char>
@@ -30,7 +30,7 @@ class utf8string : public std::vector<utf8char>
 
   utf8string & operator=(const std::string & other);
   utf8string & operator=(const char * const other);
-  bool operator==(const std::string & other);
+  bool operator==(const std::string & other) const;
   void replace(utf8char from, utf8char to);
 };
 
diff --git a/common/src/utf8string.cpp b/common/src/utf8string.cpp
index 374ff9d..70cdb34 100644
--- a/common/src/utf8string.cpp
+++ b/common/src/utf8string.cpp
@@ -31,7 +31,7 @@ util::utf8char & util::utf8char::operator=(const std::string & other)
   return *this = splited[0];
 }
 
-bool util::utf8char::operator==(const std::string & other)
+bool util::utf8char::operator==(const std::string & other) const
 {
   auto splited = splitAsUtf8(other);
   if (splited.size() > 1)
@@ -39,12 +39,12 @@ bool util::utf8char::operator==(const std::string & other)
   return *this == splited[0];
 }
 
-bool util::utf8char::operator==(char other)
+bool util::utf8char::operator==(char other) const
 {
   return (*this)[0] == other && !(*this)[1] && !(*this)[2] && !(*this)[3];
 }
 
-bool util::utf8char::operator!=(char other)
+bool util::utf8char::operator!=(char other) const
 {
   return ! (*this==other);
 }
@@ -63,7 +63,7 @@ util::utf8string & util::utf8string::operator=(const char * const other)
   return operator=(std::string(other));
 }
 
-bool util::utf8string::operator==(const std::string & other)
+bool util::utf8string::operator==(const std::string & other) const
 {
   if (size() != other.size())
     return false;
-- 
GitLab