# HG changeset patch # User David Bateman # Date 1305144152 -7200 # Node ID 68a59630798d1aae7e23003a7196232d897f58a8 # Parent aa3ba343a76f4d75a25beed27aae7967a2112f58 Fix case insenstive use of radio values in graphics objects (bug #33068) * caseless-str.h (bool operator < (const std::string& s) const)): New operator in the caseless_str class. diff --git a/liboctave/caseless-str.h b/liboctave/caseless-str.h --- a/liboctave/caseless-str.h +++ b/liboctave/caseless-str.h @@ -46,6 +46,29 @@ operator std::string (void) const { return *this; } + bool operator < (const std::string& s) const + { + bool same = true; + const_iterator p1 = begin (); + const_iterator p2 = s.begin (); + + while (p1 != end () && p2 != s.end ()) + { + if (std::tolower (*p2) < std::tolower (*p1)) + return false; + if (same && (std::tolower (*p2) != std::tolower (*p1))) + same = false; + + *p1++; + *p2++; + } + + if (same && (length() >= s.length ())) + return false; + else + return true; + } + // Case-insensitive comparison. bool compare (const std::string& s, size_t limit = std::string::npos) const {