s11n::io::key_value_serializer< NodeType > Class Template Reference

A helper for serializing properties to a stream. More...

#include <data_node_format.hpp>

List of all members.

Public Types

typedef NodeType node_type
typedef node_type::value_type pair_type
typedef std::map< std::string,
std::string > 
entity_translation_map

Public Member Functions

 key_value_serializer (const entity_translation_map *map, std::ostream &dest, const std::string &prefix, const std::string &separator, const std::string &suffix)
 map: needed so we can do entity translation in a unified manner here.
void operator() (const pair_type &src) const
 Sends the following formatted string to os:.


Detailed Description

template<typename NodeType>
class s11n::io::key_value_serializer< NodeType >

A helper for serializing properties to a stream.

Intended for use by Serializers, not Serializables.

NodeType is the container type used for data serialization (e.g. s11n::data_node).

Definition at line 717 of file data_node_format.hpp.


Member Typedef Documentation

template<typename NodeType>
typedef NodeType s11n::io::key_value_serializer< NodeType >::node_type

Definition at line 720 of file data_node_format.hpp.

template<typename NodeType>
typedef node_type::value_type s11n::io::key_value_serializer< NodeType >::pair_type

Definition at line 721 of file data_node_format.hpp.

template<typename NodeType>
typedef std::map<std::string,std::string> s11n::io::key_value_serializer< NodeType >::entity_translation_map

Definition at line 723 of file data_node_format.hpp.


Constructor & Destructor Documentation

template<typename NodeType>
s11n::io::key_value_serializer< NodeType >::key_value_serializer ( const entity_translation_map map,
std::ostream &  dest,
const std::string &  prefix,
const std::string &  separator,
const std::string &  suffix 
) [inline]

map: needed so we can do entity translation in a unified manner here.

It must outlive this object. Pass it 0 for no translation. Translations are only applied on VALUES, not KEYS.

prefix: inserted before each property.

separator: inserted between the key and value.

suffix: appended after each entry.

Definition at line 740 of file data_node_format.hpp.


Member Function Documentation

template<typename NodeType>
void s11n::io::key_value_serializer< NodeType >::operator() ( const pair_type src  )  const [inline]

Sends the following formatted string to os:.

{prefix}{src.first}{separator}{src.second}{suffix}

Definition at line 756 of file data_node_format.hpp.

References s11n::io::strtool::to(), s11n::io::strtool::translate_entities(), and s11n::val().


The documentation for this class was generated from the following file:
Generated on Thu Feb 8 10:28:00 2007 for libs11n-1.2.5 by  doxygen 1.5.0