summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-02-21 00:05:15 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-02-21 00:06:30 -0300
commitde0045cf1b0a5e20fbf74da192039d344ee8d0c7 (patch)
tree2581bd8995461f1c3d9245f336fd88175b52770e /core/ustring.cpp
parent6e2bf31e5a8f3dbe18e31b1aff9c26ee184ad8c8 (diff)
-renamed globals.h to global_config.cpp (this seems to have caused a few modified files)
-.pck and .zip exporting redone, seems to be working..
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())