From 46f990e09b66585b53477cfbc2587e595a40a63e Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Thu, 30 Jul 2015 14:35:58 +0200 Subject: [PATCH] LookupTable must be case-insensitive --- src/base/LookupTable.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/base/LookupTable.h b/src/base/LookupTable.h index 795f499800..265d44e0d0 100644 --- a/src/base/LookupTable.h +++ b/src/base/LookupTable.h @@ -14,7 +14,7 @@ #include /** - * a record in he initializer list for a LookupTable + * a record in the initializer list for a LookupTable * * In case it is wished to extend the structure of a LookupTable's initializer * list, it can be done by using a custom struct which must match @@ -30,7 +30,7 @@ struct LookupTableRecord }; /** - * SBuf -> enum lookup table + * SBuf -> case-insensitive enum lookup table * * How to use: * enum enum_type { ... }; @@ -45,6 +45,12 @@ struct LookupTableRecord * if (item != ENUM_INVALID_VALUE) { // do stuff } * */ + +struct SBufCaseInsensitiveLess : public std::binary_function { + bool operator() (const SBuf &x, const SBuf &y) const { + return x.caseCmp(y) < 0; + } +}; template > class LookupTable { @@ -68,7 +74,7 @@ public: } private: - typedef std::map lookupTable_t; + typedef std::map lookupTable_t; lookupTable_t lookupTable; EnumType invalidValue; }; -- 2.47.2