s11n::subnode_serializer_f< NodeType > Struct Template Reference

A helper functor to loop over serializable children. More...

#include <algo.hpp>

List of all members.

Public Types

typedef NodeType node_type

Public Member Functions

 subnode_serializer_f (node_type &dest, const std::string &subname)
 Creates an object for serializing.
template<typename SerializableT>
bool operator() (const SerializableT *src)
 Serializes src into a subnode of dest using the name given in this object's ctor.
template<typename SerializableT>
bool operator() (const SerializableT &src)

Public Attributes

bool result
 For use as a "return value catcher" for std::for_each().


Detailed Description

template<typename NodeType>
struct s11n::subnode_serializer_f< NodeType >

A helper functor to loop over serializable children.

Designed for use with std::for_each().

NodeType must be compatible with s11n node conventions.

Please see the operator() docs for important usage information, especially if you want to use this object outside the context of for_each().

Definition at line 417 of file algo.hpp.


Member Typedef Documentation

template<typename NodeType>
typedef NodeType s11n::subnode_serializer_f< NodeType >::node_type

Definition at line 419 of file algo.hpp.


Constructor & Destructor Documentation

template<typename NodeType>
s11n::subnode_serializer_f< NodeType >::subnode_serializer_f ( node_type dest,
const std::string &  subname 
) [inline]

Creates an object for serializing.

Preconditions:

Definition at line 431 of file algo.hpp.


Member Function Documentation

template<typename NodeType>
template<typename SerializableT>
bool s11n::subnode_serializer_f< NodeType >::operator() ( const SerializableT *  src  )  [inline]

Serializes src into a subnode of dest using the name given in this object's ctor.

Note that during an, e.g., for_each() this object will return false on a failed serialize, and will CONTINUE to return false on additional serializations. This is to avoid the possibility that for_each() fails on the first item of a list, handles 3000 items, and then the whole thing fails because of the first one. Thus, this operator will never process another request once it has returned false ONCE.

Versions prior to 1.1.3 always dereferenced src, without checking for a null pointer. As of 1.1.3, false is returned if (!src).

Definition at line 454 of file algo.hpp.

References s11n::subnode_serializer_f< NodeType >::result, and s11nlite::serialize_subnode().

Referenced by s11n::subnode_serializer_f< NodeType >::operator()().

template<typename NodeType>
template<typename SerializableT>
bool s11n::subnode_serializer_f< NodeType >::operator() ( const SerializableT &  src  )  [inline]

Definition at line 463 of file algo.hpp.

References s11n::subnode_serializer_f< NodeType >::operator()().


Member Data Documentation

template<typename NodeType>
bool s11n::subnode_serializer_f< NodeType >::result

For use as a "return value catcher" for std::for_each().

See operator() for how it is set. The starting value is true, which means that looping over an empty list with this object will return a true result (which is the convention in s11n).

Definition at line 475 of file algo.hpp.

Referenced by s11n::subnode_serializer_f< NodeType >::operator()().


The documentation for this struct was generated from the following file:
Generated on Wed Jun 4 21:44:20 2008 for libs11n by  doxygen 1.5.3