Make metadata tags case insensitive
This commit is contained in:
parent
807cce12ff
commit
5a615ec680
2 changed files with 13 additions and 2 deletions
12
src/item.cc
12
src/item.cc
|
|
@ -103,6 +103,16 @@ optional<value_t> item_t::get_tag(const mask_t& tag_mask,
|
||||||
return none;
|
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::string_map::iterator
|
||||||
item_t::set_tag(const string& tag,
|
item_t::set_tag(const string& tag,
|
||||||
const optional<value_t>& value,
|
const optional<value_t>& value,
|
||||||
|
|
@ -111,7 +121,7 @@ item_t::set_tag(const string& tag,
|
||||||
assert(! tag.empty());
|
assert(! tag.empty());
|
||||||
|
|
||||||
if (! metadata)
|
if (! metadata)
|
||||||
metadata = string_map();
|
metadata = string_map(CaseInsensitiveKeyCompare());
|
||||||
|
|
||||||
DEBUG("item.meta", "Setting tag '" << tag << "' to value '"
|
DEBUG("item.meta", "Setting tag '" << tag << "' to value '"
|
||||||
<< (value ? *value : string_value("<none>")) << "'");
|
<< (value ? *value : string_value("<none>")) << "'");
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,8 @@ public:
|
||||||
enum state_t { UNCLEARED = 0, CLEARED, PENDING };
|
enum state_t { UNCLEARED = 0, CLEARED, PENDING };
|
||||||
|
|
||||||
typedef std::pair<optional<value_t>, bool> tag_data_t;
|
typedef std::pair<optional<value_t>, bool> tag_data_t;
|
||||||
typedef std::map<string, tag_data_t> string_map;
|
typedef std::map<string, tag_data_t,
|
||||||
|
function<bool(string, string)> > string_map;
|
||||||
|
|
||||||
state_t _state;
|
state_t _state;
|
||||||
optional<date_t> _date;
|
optional<date_t> _date;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue