Classes | |
struct | pair_serializer_proxy |
pair_serializer_proxy is a Serializable Proxy for std::pairs. More... | |
struct | streamable_map_serializer_proxy |
A proxy which can serialize std::maps which contain Streamable Types. More... | |
struct | map_serializer_proxy |
map_serializer_proxy is a Serialization Proxy for std::maps. More... | |
Functions | |
template<typename NodeType, typename MapType> | |
size_t | serialize_streamable_map (NodeType &dest, const MapType &src) |
template<typename NodeType, typename MapType> | |
size_t | serialize_streamable_map (NodeType &dest, const std::string &subnodename, const MapType &src) |
Exactly like serialize_streamable_map(dest,src) except that a subnode, named subnodename, of dest is created to store the data. | |
template<typename NodeType, typename MapType> | |
size_t | deserialize_streamable_map (const NodeType &src, MapType &dest) |
This is the converse of serialize_streamable_map(). | |
template<typename NodeType, typename MapType> | |
size_t | deserialize_streamable_map (const NodeType &src, const std::string &subnodename, MapType &dest) |
Exactly like deserialize_streamable_map(dest,src) except that a subnode of dest, named subnodename, is sought to pull the data from. | |
template<typename NodeType, typename PairType> | |
bool | serialize_streamable_pair (NodeType &dest, const PairType &src) |
Serializes a std::pair-compatible type into a "custom" format, suitable for saving pairs in standard XML (de/serialize_streamable_map() can't do this when keys are not valid XML keys, e.g. | |
template<typename PairType, typename NodeType> | |
PairType | deserialize_streamable_pair (const NodeType &src) |
The quasi-counterpart of serialize_streamable_pair(). | |
template<typename NodeType, typename MapType> | |
size_t | serialize_streamable_map_pairs (NodeType &dest, const MapType &src) |
Similar to serialize_streamable_map(), but puts each key/value pair into it's own node, using serialize_streamable_pair(). | |
template<typename NodeType, typename MapType> | |
size_t | deserialize_streamable_map_pairs (const NodeType &src, MapType &dest) |
The load-time counterpart to serialize_streamable_map_pairs(). | |
template<typename NodeType, typename PairType> | |
bool | serialize_pair (NodeType &dest, const PairType &src) |
serialize_pair() can serialize any std::pair type which meets these conditions: | |
template<typename NodeType, typename PairType> | |
bool | deserialize_pair (const NodeType &src, PairType &dest) |
The counterpart to serialize_pair(). | |
template<typename NodeType, typename MapType> | |
bool | serialize_map (NodeType &dest, const MapType &src) |
Serialize the given map into dest. | |
template<typename NodeType, typename MapType> | |
bool | serialize_map (NodeType &dest, const std::string &subnodename, const MapType &src) |
Identical to the two-argument form, but creates a subnode of dest, named subnodename, and serializes to that node. | |
template<typename NodeType, typename MapType> | |
bool | deserialize_map (const NodeType &src, MapType &dest) |
The counterpart of serializer_map(), deserializes src into the given map. | |
template<typename NodeType, typename MapType> | |
bool | deserialize_map (const NodeType &src, const std::string &subnodename, MapType &dest) |
Identical to the two-argument form, but tries to deserialize from a subnode of src named subnodename. |
|
Identical to the two-argument form, but tries to deserialize from a subnode of src named subnodename. If no such node is found then false is returned. Definition at line 499 of file map.h. References s11n::find_child_by_name(). |
|
The counterpart of serializer_map(), deserializes src into the given map. MapType must be Serializable and contain pairs which themselves are Serializables... ad inifinitum.. Minor caveat: This operation will only work with maps containing std::pair types, not map-like classes which use a different pair type. :( The reason is that map<X,Y>value_type is not a pair of (X,Y), but (const Y,Y), which means we cannot use the map's value_type for a deser operation because we cannot assign to it's .first element (i.e., can't deserialize it). To get around that we "manually" create a new std::pair type using map's key_type and mapped_type typedefs, which "loses" the constness for use so we can assign to the first_type during deserialization, and then insert that pair into the deserializing map. Definition at line 467 of file map.h. References deserialize_pair(). Referenced by s11n::map::map_serializer_proxy::operator()(). |
|
The counterpart to serialize_pair(). Note: std::map<X,Y>value_type is not the same as pair<X,Y>, but is pair<const X,Y>, so you cannot simply iterate over a map and pass each pair to this function, because this function cannot assign to the first element of such a pair. Definition at line 302 of file map.h. References s11n::deserialize(), and s11n::find_child_by_name(). Referenced by deserialize_map(), and s11n::map::pair_serializer_proxy::operator()(). |
|
Exactly like deserialize_streamable_map(dest,src) except that a subnode of dest, named subnodename, is sought to pull the data from. A return value of 0 indicates that either no child with the given name was found or that no deserializable items were in that node. Definition at line 127 of file map.h. References s11n::find_child_by_name(). |
|
This is the converse of serialize_streamable_map(). It tries to read in all properties stored in src and stick them into dest. NodeType must support begin() and end() and they must return iterators to pair<X,Y>, where X and Y must meet the same requirements as the key and value types for MapType in serialize_streamable_map(). MapType must support: void insert( MapType::value_type ); (Duh.) Returns the number of values deserialized into dest. Definition at line 96 of file map.h. References s11n::from_string(). Referenced by s11n::map::streamable_map_serializer_proxy::operator()(). |
|
The quasi-counterpart of serialize_streamable_pair(). It's non-conventional args and return type are a result of map::value_type having a const .first element, which prohibits us assigning to it. See deserialize_pair() for more info on that. |
|
Serialize the given map into dest. MapType's pairs must be Serializable and must contain Serializable types, but their "pointerness" is irrelevant. ACHTUNG: never pass the same destination container to the operators more than once or you will get duplicate and/or incorrect data. See deserialize_map() for important info. Definition at line 406 of file map.h. References serialize_pair(). Referenced by s11n::map::map_serializer_proxy::operator()(). |
|
serialize_pair() can serialize any std::pair type which meets these conditions:
PairType's first_type and second_type types must:
ACHTUNG: never pass the same destination container to the operators more than once or you will get duplicate and/or incorrect data. Definition at line 275 of file map.h. References s11n::create_child(), and s11n::serialize(). Referenced by s11n::map::pair_serializer_proxy::operator()(), and serialize_map(). |
|
serialize_streamable_map() is intended for use as a serialization proxy for the s11n framework. It de/serializes objects of type NodeType must support: set( const std::string & key, const std::string & value )
Returns the number of values serialized into dest. Definition at line 48 of file map.h. Referenced by s11n::map::streamable_map_serializer_proxy::operator()(), and serialize_streamable_map(). |
|
Similar to serialize_streamable_map(), but puts each key/value pair into it's own node, using serialize_streamable_pair(). The end effect is that it's output is more verbose, but may be compatible with more file formats, regardless of the actual key type. e.g., numeric keys are supported by standard XML (though they are by the s11n XML parsers), and this algorithm structures the data such that this is not a problem. Returns the number of pairs stored. MapType must meet these conditions: value_type must be a pair containing i/ostreamable types (e.g. PODs/strings). Definition at line 210 of file map.h. References s11n::create_child(), and serialize_streamable_pair(). |
|
Serializes a std::pair-compatible type into a "custom" format, suitable for saving pairs in standard XML (de/serialize_streamable_map() can't do this when keys are not valid XML keys, e.g. , numeric). Use deserialize_streamable_pair() to decode the data. The destination node gets these two properties:
PairType must comply with:
Returns true on success... and never fails. Honestly. It'll fail at compile-time if it's going to fail. use deserialize_streamable_pair() to convert them back to pairs, or fish out the "first" and "second" properties manually. Definition at line 163 of file map.h. Referenced by serialize_streamable_map_pairs(). |