From 5a615ec680190222e25047366f166f9daf89c69f Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 4 Apr 2012 02:27:49 -0500 Subject: Make metadata tags case insensitive --- src/item.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/item.cc') 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 item_t::get_tag(const mask_t& tag_mask, return none; } +namespace { + struct CaseInsensitiveKeyCompare + : public std::binary_function + { + 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, @@ -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("")) << "'"); -- cgit v1.2.3