26 jsonNode[it->first] = it->second->toJSON();
34 if(jsonNode.is_null() || jsonNode.empty())
37 for(
auto it = jsonNode.begin(),
end = jsonNode.end(); it !=
end; ++it) {
39 insert(it.key(), it.value());
41 throw Exception(
"cannot insert node '%s' in FieldMap: JSON node ill-formed: %s", it.key(),
48 return (stream <<
"FieldMap = " << s.
toJSON().dump(4));
map_type::const_iterator const_iterator
A forward iterator to const value_type
iterator begin() noexcept
Returns an iterator pointing to the first element in the FieldMap.
bool empty() const noexcept
Returns a bool value indicating whether the FieldMap is empty.
Namespace of the serialbox library.
void fromJSON(const json::json &jsonNode)
Construct from JSON node.
bool insert(StringType &&key, Args &&... args)
Insert a new field in the map.
iterator end() noexcept
Returns an iterator pointing to the past-the-end element in the FieldMap.
void clear() noexcept
All the elements in the FieldMap are dropped: their destructors are called, and they are removed from...
json::json toJSON() const
Convert to JSON.
Exception class which stores a human-readable error description.
Hash-map to query the meta-information of the registered fields.
friend std::ostream & operator<<(std::ostream &stream, const FieldMap &s)
Convert to stream.