summaryrefslogtreecommitdiff
path: root/AK/String.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-09 13:33:52 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-09 13:33:52 +0100
commit7d1142c7d9faaa1ca2f8e9c246c618292ced0119 (patch)
tree3035cf7b964cbd71d8c488b4820579d4f9db80e0 /AK/String.cpp
parent0680fe238353ab403418580349dd302ac2397ec6 (diff)
downloadserenity-7d1142c7d9faaa1ca2f8e9c246c618292ced0119.zip
Make it possible to sort a GTableModel by column+order.
This is accomplished by putting a GSortingProxyTableModel between the model and the view. It's pretty simplistic but it works for this use case. :^)
Diffstat (limited to 'AK/String.cpp')
-rw-r--r--AK/String.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/AK/String.cpp b/AK/String.cpp
index 4c3e2692ac..fe48dc004c 100644
--- a/AK/String.cpp
+++ b/AK/String.cpp
@@ -19,6 +19,17 @@ bool String::operator==(const String& other) const
return !memcmp(characters(), other.characters(), length());
}
+bool String::operator<(const String& other) const
+{
+ if (!m_impl)
+ return other.m_impl;
+
+ if (!other.m_impl)
+ return false;
+
+ return strcmp(characters(), other.characters());
+}
+
String String::empty()
{
return StringImpl::the_empty_stringimpl();