Skip to content

Commit

Permalink
libcore|Tests: Revised StringPool with case-insensitive comparators
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent 49e1136 commit e1b1741
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 72 deletions.
2 changes: 2 additions & 0 deletions doomsday/libs/core/include/de/data/hash.h
Expand Up @@ -37,6 +37,7 @@ class Hash : public std::unordered_map<Key, Value, HashFn, KeyEqual>

public:
Hash() {}
Hash(Hash &&moved) : Base(moved) {}

Hash(const std::initializer_list<typename Base::value_type> &init)
{
Expand All @@ -53,6 +54,7 @@ class Hash : public std::unordered_map<Key, Value, HashFn, KeyEqual>
bool contains(const Key &key) const { return Base::find(key) != Base::end(); }
Value & operator[](const Key &key) { return Base::operator[](key); }
const Value &operator[](const Key &key) const { return Base::find(key)->second; }
Hash & operator=(Hash &&moved) { Base::operator=(moved); return *this; }

Value take(const Key &key)
{
Expand Down
2 changes: 2 additions & 0 deletions doomsday/libs/core/include/de/data/set.h
Expand Up @@ -35,6 +35,7 @@ class Set : public std::unordered_set<Value>

public:
Set() {}
Set(Set &&moved) : Base(moved) {}

template <typename T>
Set(const std::initializer_list<T> &init)
Expand All @@ -54,6 +55,7 @@ class Set : public std::unordered_set<Value>
void remove(const Value &value) { Base::erase(value); }
bool contains(const Value &value) const { return Base::find(value) != end(); }
Set & operator<<(const Value &value) { Base::insert(value); return *this; }
Set & operator=(Set &&moved) { Base::operator=(moved); return *this; }
};

template <typename T>
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libs/core/include/de/data/stringpool.h
Expand Up @@ -217,7 +217,7 @@ class DE_PUBLIC StringPool : public ISerializable
*
* @param func Callback to make for each string.
*/
LoopResult forAll(std::function<LoopResult (Id)> func) const;
LoopResult forAll(const std::function<LoopResult (Id)>& func) const;

// Implements ISerializable.
void operator >> (Writer &to) const;
Expand Down

0 comments on commit e1b1741

Please sign in to comment.