Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members

s11nlite Namespace Reference


Classes

struct  node_deserializer
 deserializer is a functor for deserializing SerializableType objects from node_type objects. More...

Namespaces

namespace  sharing
 The sharing namespace contains "sharing context" classes.

Typedefs

typedef s11n::data_node node_type
 node_type is the type used to store/load a Serializable object's data.
typedef S11NLITE_DEFAULT_SERIALIZER_BASE_TYPE serializer_base_type
 This is the base-most type of the serializers used by s11nlite.
typedef s11n::io::data_node_serializer<
node_type
base_serializer
 Short-form name of the base serializer type for s11n::data_node.
typedef s11n::io::compact_serializer<
node_type
compact
 Short-form name of the compact_serializer for s11n::data_node.
typedef s11n::io::funtxt_serializer<
node_type
funtxt
 Short-form name of the funtxt_serializer for s11n::data_node.
typedef s11n::io::funxml_serializer<
node_type
funxml
 Short-form name of the funxml_serializer for s11n::data_node.
typedef s11n::io::parens_serializer<
node_type
parens
 Short-form name of the parens_serializer for s11n::data_node.
typedef s11n::io::simplexml_serializer<
node_type
simplexml
 Short-form name of the simplexml_serializer for s11n::data_node.
typedef S11NLITE_DEFAULT_SERIALIZER_TYPE default_serializer_type
 This is the default serializer used by s11nlite.

Functions

serializer_base_typecreate_serializer ()
 Returns a new instance of the default serializer class.
serializer_base_typecreate_serializer (const std::string &classname)
 Returns a new instance of the given serializer class, or 0 if one could not be loaded.
void serializer_class (const std::string &)
 Sets the current Serializer class used by s11nlite's create_serializer().
std::string serializer_class ()
 Gets the name of the current Serializer type.
node_typefind_child (node_type &parent, const std::string subnodename)
 A non-const overload.
const node_typefind_child (const node_type &parent, const std::string subnodename)
 Equivalent to s11n::find_child_by_name( parent, subnodename ).
template<typename SerializableType>
bool serialize (node_type &dest, const SerializableType &src)
 See s11n::serialize().
template<typename SerializableType>
bool serialize_subnode (node_type &dest, const std::string &subnodename, const SerializableType &src)
 See s11n::serialize().
bool save (const node_type &src, std::ostream &dest)
 Saves the given node to the given ostream using the default serializer type.
bool save (const node_type &src, const std::string &filename)
 Saves the given node to the given filename using the default serializer type.
template<typename SerializableType>
bool save (const SerializableType &src, std::ostream &dest)
 Saves the given Serializable to the given ostream using the default serializer type.
template<typename SerializableType>
bool save (const SerializableType &src, const std::string &dest)
 Saves the given Serializable to the given filename using the default serializer type.
node_typeload_node (const std::string &src)
 Tries to load a node from the given filename.
node_typeload_node (std::istream &src)
 Tries to load a node from the given input stream.
template<typename SerializableType>
SerializableType * deserialize (const node_type &src)
 A free-function equivalent to deserializer<>.
template<typename SerializableType>
SerializableType * deserialize (const node_type &src, const std::string &subnodename)
 Tries to find a subnode of src named subnodename.
template<typename DeserializableT>
bool deserialize (const node_type &src, DeserializableT &target)
 Tries to deserialize src into target.
template<typename DeserializableT>
bool deserialize_subnode (const node_type &src, const std::string &subnodename, DeserializableT &target)
 Exactly like deserialize(), but operates on a subnode of src named subnodename.
template<typename DeserializableT>
DeserializableT * deserialize_subnode (const node_type &src, const std::string &subnodename)
 Exactly like deserialize(), but operates on a subnode of src named subnodename.
template<typename SerializableType>
SerializableType * load_serializable (std::istream &src)
 Tries to load a data_node from src, then deserialize that to a SerializableType.
template<typename SerializableType>
SerializableType * load_serializable (const std::string &src, bool AsFile=true)
 Overloaded form which takes a file name.
template<typename SerializableType>
SerializableType * clone (const SerializableType &tocp)
 See s11n::clone().
template<typename Type1, typename Type2>
bool s11n_cast (const Type1 &t1, Type2 &t2)
 See s11n::s11n_cast().


Typedef Documentation

typedef S11NLITE_DEFAULT_SERIALIZER_TYPE s11nlite::default_serializer_type
 

This is the default serializer used by s11nlite.

This can be set at compile-time by defining S11NLITE_DEFAULT_SERIALIZER_TYPE to the fully-qualified class name of the deserializer. The type is restricted to a subtype of S11NLITE_DEFAULT_SERIALIZER_BASE_TYPE.

The exact type of the default implementation is not defined by the s11nlite interface.

Definition at line 144 of file s11nlite.h.

typedef S11NLITE_DEFAULT_SERIALIZER_BASE_TYPE s11nlite::serializer_base_type
 

This is the base-most type of the serializers used by s11nlite.

This can be set at compile-time by defining S11NLITE_DEFAULT_SERIALIZER_BASE_TYPE to the fully-qualified class name of the base-most Serializer type.

Definition at line 117 of file s11nlite.h.


Function Documentation

serializer_base_type* s11nlite::create_serializer const std::string &  classname  ) 
 

Returns a new instance of the given serializer class, or 0 if one could not be loaded.

classname must represent a subtype of serializer_base_type.

The caller owns the returned pointer.

You can also pass a serializer's cookie here, and that should return the same thing as it's class name would.

The internally-supported serializes all support a "friendly form" of the name, an alias registered with their classloader. Passing either this name or the cookie of the Serializer should return the same thing as the classname itself would.

Short-form names of internally-supported Serializers:

  • compact
  • funtxt, text, txt
  • funxml, xml
  • parens
  • simplexml

Note that the short-form name is always the same as that of the underlying Serializer class, minus the _serializer suffix. This is purely a convention, and a rule.

serializer_base_type* s11nlite::create_serializer  ) 
 

Returns a new instance of the default serializer class.

The caller owns the returned pointer.

template<typename DeserializableT>
bool s11nlite::deserialize const node_type &  src,
DeserializableT &  target
 

Tries to deserialize src into target.

Returns true on success. If false is returned then target is not guaranteed to be in a useful state: this depends entirely on the object (but, it could be argued, it it was in a useful state it's deserialize operator would have returned true!).

Definition at line 393 of file s11nlite.h.

template<typename SerializableType>
SerializableType* s11nlite::deserialize const node_type &  src,
const std::string &  subnodename
 

Tries to find a subnode of src named subnodename.

If it finds it, it tries to deserialize<SerializableT>( thenode ). Returns the result of deserialize( thenode ), or 0 if no such child could be found.

Definition at line 378 of file s11nlite.h.

References s11n::find_child_by_name().

template<typename SerializableType>
SerializableType* s11nlite::deserialize const node_type &  src  ) 
 

A free-function equivalent to deserializer<>.

It is implemented in terms of deserializer<>, so that specializations of that class will be picked up by calls to this function, allowing clients to selectively replace certain ones.

ACHTUNG: if you are using both s11n and s11nlite namespaces this function will be ambiguous with one provided in the namespace s11n. You must then qualify it with the namespace of the one you wish to use.

Definition at line 364 of file s11nlite.h.

Referenced by s11n_cast().

template<typename DeserializableT>
DeserializableT* s11nlite::deserialize_subnode const node_type &  src,
const std::string &  subnodename
 

Exactly like deserialize(), but operates on a subnode of src named subnodename.

Returns false if no such file is found.

Definition at line 419 of file s11nlite.h.

References s11n::deserialize_subnode().

template<typename DeserializableT>
bool s11nlite::deserialize_subnode const node_type &  src,
const std::string &  subnodename,
DeserializableT &  target
 

Exactly like deserialize(), but operates on a subnode of src named subnodename.

Returns false if no such file is found.

Definition at line 404 of file s11nlite.h.

References s11n::deserialize_subnode().

node_type* s11nlite::find_child node_type &  parent,
const std::string  subnodename
 

A non-const overload.

Ownership is not modified by calling this function: normally the parent node owns it.

node_type* s11nlite::load_node std::istream &  is  ) 
 

Tries to load a node from the given input stream.

ACHTUNG: Only usable for loading ROOT nodes.

Definition at line 278 of file data_node_io.h.

node_type* s11nlite::load_node const std::string &  src  ) 
 

Tries to load a node from the given filename.

The caller owns the returned pointer.

Referenced by load_serializable().

template<typename SerializableType>
SerializableType* s11nlite::load_serializable const std::string &  src,
bool  AsFile = true
 

Overloaded form which takes a file name.

See get_istream() for a description of the AsFile parameter.

Definition at line 448 of file s11nlite.h.

References s11n::get_istream().

template<typename SerializableType>
bool s11nlite::save const SerializableType &  src,
const std::string &  dest
 

Saves the given Serializable to the given filename using the default serializer type.

Returns true on success, false on error.

ONLY use this for saving root nodes!

Definition at line 296 of file s11nlite.h.

References s11n::get_ostream(), and save().

template<typename SerializableType>
bool s11nlite::save const SerializableType &  src,
std::ostream &  dest
 

Saves the given Serializable to the given ostream using the default serializer type.

Returns true on success, false on error.

ONLY use this for saving root nodes!

Definition at line 280 of file s11nlite.h.

References save(), and serialize().

bool s11nlite::save const node_type &  src,
const std::string &  filename
 

Saves the given node to the given filename using the default serializer type.

Returns true on success, false on error.

ONLY use this for saving root nodes!

bool s11nlite::save const node_type &  src,
std::ostream &  dest
 

Saves the given node to the given ostream using the default serializer type.

Returns true on success, false on error.

ONLY use this for saving root nodes!

Referenced by save().

void s11nlite::serializer_class const std::string &   ) 
 

Sets the current Serializer class used by s11nlite's create_serializer().

Pass it a class name, or one of the convenience names:

compact, funtxt, funxml, simplexml, parens


Generated on Thu Jun 16 16:18:13 2005 for s11n by  doxygen 1.4.3-20050530