15 #ifndef SERIALBOX_CORE_METAINFOMAPIMPL_H 16 #define SERIALBOX_CORE_METAINFOMAPIMPL_H 24 #include <unordered_map> 41 using map_type = std::unordered_map<std::string, MetainfoValueImpl>;
87 template <
class StringType>
88 bool hasKey(StringType&& key)
const noexcept {
89 return (map_.find(key) != map_.end());
97 std::vector<std::string>
keys()
const;
104 std::vector<TypeID>
types()
const;
113 template <
class StringType>
115 return map_.find(key);
117 template <
class StringType>
119 return map_.find(key);
131 template <
class KeyType,
class ValueType>
132 bool insert(KeyType&& key, ValueType&& value) noexcept {
133 return (map_.insert({key, MetainfoValueImpl(std::forward<ValueType>(value))}).second);
148 template <
class ValueType,
class KeyType>
149 ValueType
as(KeyType&& key)
const {
150 return at(key).template as<ValueType>();
172 std::size_t
size() const noexcept {
return map_.size(); }
176 bool empty() const noexcept {
return map_.empty(); }
180 void clear() noexcept { map_.clear(); }
200 json::json
toJSON()
const;
205 void fromJSON(
const json::json& jsonNode);
Namespace of the serialbox library.