summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index a0d26ea0af..c13c13ec11 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -52,8 +52,40 @@
#define UPPERCASE(m_c) (((m_c)>='a' && (m_c)<='z')?((m_c)-('a'-'A')):(m_c))
#define LOWERCASE(m_c) (((m_c)>='A' && (m_c)<='Z')?((m_c)+('a'-'A')):(m_c))
+
+
+
/** STRING **/
+bool CharString::operator<(const CharString& p_right) const {
+
+ if (length()==0) {
+ return p_right.length()!=0;
+ }
+
+
+ const char *this_str=get_data();
+ const char *that_str=get_data();
+ while (true) {
+
+ if (*that_str==0 && *this_str==0)
+ return false; //this can't be equal, sadly
+ else if (*this_str==0)
+ return true; //if this is empty, and the other one is not, then we're less.. I think?
+ else if (*that_str==0)
+ return false; //otherwise the other one is smaller..
+ else if (*this_str < *that_str ) //more than
+ return true;
+ else if (*this_str > *that_str ) //less than
+ return false;
+
+ this_str++;
+ that_str++;
+ }
+
+ return false; //should never reach here anyway
+}
+
const char *CharString::get_data() const {
if (size())