26 T
get(
const String& key,
const T& default_value = T{})
const {
27 auto it = data.find(key);
28 if (it == data.end()) {
33 return std::any_cast<T>(it->second);
34 }
catch (
const std::bad_any_cast&) {
47 auto it = data.find(key);
49 if (it == data.end()) {
53 return it->second.type() ==
typeid(T);
60 template <
typename Func>
69 template <
typename Func>
71 for (
auto& pair : data) {
72 func(pair.first, pair.second);
Definition: dictionary.h:8
bool is_type(const String &key) const
Definition: dictionary.h:46
size_t size() const
Definition: dictionary.cpp:4
void clear()
Definition: dictionary.cpp:12
auto end()
Definition: dictionary.cpp:54
void merge(const Dictionary &other, bool overwrite=false)
Definition: dictionary.cpp:41
std::type_index get_type(const String &key) const
Definition: dictionary.cpp:33
bool has(const String &key) const
Definition: dictionary.cpp:16
Vector< String > keys() const
Definition: dictionary.cpp:24
void for_each(Func func)
Definition: dictionary.h:70
bool is_empty() const
Definition: dictionary.cpp:8
bool erase(const String &key)
Definition: dictionary.cpp:20
void set(const String &key, const T &value)
Definition: dictionary.h:21
auto begin()
Definition: dictionary.cpp:50
T get(const String &key, const T &default_value=T{}) const
Definition: dictionary.h:26
std::unordered_map< K, V > HashMap
Definition: type_alias.h:20