From 7a9d314016476172e6bcecde5e510bfb44dcfe0a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 4 Apr 2015 16:16:51 -0400 Subject: [PATCH] Variant: Temporarily put back the priority string handling - In order to test that the UDA sorting is good, the priority processing must be in place, as many test rely on priority values. Will be removed later. --- src/Variant.cpp | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/Variant.cpp b/src/Variant.cpp index 855718762..6b4c9793e 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -315,6 +315,14 @@ bool Variant::operator< (const Variant& other) const return left._string < right._string; case type_string: + if (left.source () == "priority" || right.source () == "priority") + { + if (left._string != "H" && right._string == "H") return true; + else if (left._string == "L" && right._string == "M") return true; + else if (left._string == "" && right._string != "") return true; + else return false; + } + else { if (left._string == right._string) return false; @@ -466,9 +474,18 @@ bool Variant::operator<= (const Variant& other) const return left._string <= right._string; case type_string: + if (left.source () == "priority" || right.source () == "priority") + { + if (left._string == right._string ) return true; + else if ( right._string == "H") return true; + else if (left._string == "L" && right._string == "M") return true; + else if (left._string == "" ) return true; + else return false; + } + else { if (left._string == right._string) - return false; + return true; auto order = Task::customOrder.find (left.source ()); if (order != Task::customOrder.end ()) @@ -617,6 +634,14 @@ bool Variant::operator> (const Variant& other) const return left._string > right._string; case type_string: + if (left.source () == "priority" || right.source () == "priority") + { + if (left._string == "H" && right._string != "H") return true; + else if (left._string == "M" && right._string == "L") return true; + else if (left._string != "" && right._string == "") return true; + else return false; + } + else { if (left._string == right._string) return false; @@ -768,9 +793,18 @@ bool Variant::operator>= (const Variant& other) const return left._string >= right._string; case type_string: + if (left.source () == "priority" || right.source () == "priority") + { + if (left._string == right._string ) return true; + else if (left._string == "H" ) return true; + else if (left._string == "M" && right._string == "L") return true; + else if ( right._string == "" ) return true; + else return false; + } + else { if (left._string == right._string) - return false; + return true; auto order = Task::customOrder.find (left.source ()); if (order != Task::customOrder.end ())