Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/label.cc11
-rw-r--r--src/core/label.h5
2 files changed, 16 insertions, 0 deletions
diff --git a/src/core/label.cc b/src/core/label.cc
index d7dabc2..7f21f70 100644
--- a/src/core/label.cc
+++ b/src/core/label.cc
@@ -8,6 +8,17 @@
namespace core {
+bool Label::compare(const Label *first, const Label *second)
+{
+ if (first->label() < second->label()) {
+ return true;
+ } else if (first->label() > second->label()) {
+ return false;
+ } else {
+ return (first->label().length() < second->label().length());
+ }
+}
+
Label::Label()
{
}
diff --git a/src/core/label.h b/src/core/label.h
index 2ca40f7..582ea32 100644
--- a/src/core/label.h
+++ b/src/core/label.h
@@ -44,6 +44,11 @@ public:
void set_name(const char *name);
+ /**
+ * @brief static compare function for std::container sort functions
+ */
+ static bool compare(const Label *first, const Label *second);
+
private:
std::string labelstr;
std::string namestr;