summaryrefslogtreecommitdiff
path: root/src/item.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-04-04 02:27:49 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-04-04 02:27:49 -0500
commit5a615ec680190222e25047366f166f9daf89c69f (patch)
tree133ec9582c4cf0740e33c75d1cc8d528829b6ef1 /src/item.cc
parent807cce12ff7d1f3f950853694c0603f20021bff0 (diff)
downloadfork-ledger-5a615ec680190222e25047366f166f9daf89c69f.tar.gz
fork-ledger-5a615ec680190222e25047366f166f9daf89c69f.tar.bz2
fork-ledger-5a615ec680190222e25047366f166f9daf89c69f.zip
Make metadata tags case insensitive
Diffstat (limited to 'src/item.cc')
-rw-r--r--src/item.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/item.cc b/src/item.cc
index 06b718b0..5262d1db 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -103,6 +103,16 @@ optional<value_t> item_t::get_tag(const mask_t& tag_mask,
return none;
}
+namespace {
+ struct CaseInsensitiveKeyCompare
+ : public std::binary_function<string, string, bool>
+ {
+ bool operator()(const string& s1, const string& s2) const {
+ return boost::algorithm::ilexicographical_compare(s1, s2);
+ }
+ };
+}
+
item_t::string_map::iterator
item_t::set_tag(const string& tag,
const optional<value_t>& value,
@@ -111,7 +121,7 @@ item_t::set_tag(const string& tag,
assert(! tag.empty());
if (! metadata)
- metadata = string_map();
+ metadata = string_map(CaseInsensitiveKeyCompare());
DEBUG("item.meta", "Setting tag '" << tag << "' to value '"
<< (value ? *value : string_value("<none>")) << "'");