io::legacy_reader Class Reference

Implements the io::reader interface using the "legacy" data format. More...

#include <io/iolegacy.h>

Inheritance diagram for io::legacy_reader:

Inheritance graph
[legend]
Collaboration diagram for io::legacy_reader:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 legacy_reader (std::istream &is)
virtual io::version_id input_version_id ()
virtual char read_char (const rutz::fstring &name)
 Read the char attribute associated with the tag name.
virtual int read_int (const rutz::fstring &name)
 Read the int attribute associated with the tag name.
virtual bool read_bool (const rutz::fstring &name)
 Read the bool attribute associated with the tag name.
virtual double read_double (const rutz::fstring &name)
 Read the double attribute associated with the tag name.
virtual void read_value_obj (const rutz::fstring &name, rutz::value &v)
 Read the rutz::value attribute associated with the tag name.
virtual void read_byte_array (const rutz::fstring &name, rutz::byte_array &data)
 Read the raw data array associated with the tag name.
virtual nub::ref
< io::serializable
read_object (const rutz::fstring &name)
virtual nub::soft_ref
< io::serializable
read_weak_object (const rutz::fstring &name)
virtual void read_owned_object (const rutz::fstring &name, nub::ref< io::serializable > obj)
virtual void read_base_class (const rutz::fstring &base_class_name, nub::ref< io::serializable > base_part)
virtual nub::ref
< io::serializable
read_root (io::serializable *root=0)
int ensure_version_id (const char *name, io::version_id lowest_supported_version, const char *msg, const rutz::file_pos &pos)
Overloaded read functions
These functions offer a set of overloads to provide compile-time polymorphism so that any supported type (any basic type, or rutz::value, a string type) or can be read with the same source code.

void read_value (const rutz::fstring &name, char &ret)
void read_value (const rutz::fstring &name, int &ret)
void read_value (const rutz::fstring &name, unsigned int &ret)
void read_value (const rutz::fstring &name, unsigned long &ret)
void read_value (const rutz::fstring &name, bool &ret)
void read_value (const rutz::fstring &name, double &ret)
void read_value (const rutz::fstring &name, rutz::fstring &ret)
void read_value (const rutz::fstring &name, rutz::value &ret)

Protected Member Functions

virtual rutz::fstring read_string_impl (const rutz::fstring &name)
 Read the string attribute associated with the tag name.
void default_read_byte_array (const rutz::fstring &name, rutz::byte_array &data)
 Base64 implementation of read_byte_array() for use by subclasses.

Friends

class impl

Classes

class  impl


Detailed Description

Implements the io::reader interface using the "legacy" data format.

Definition at line 54 of file iolegacy.h.


Member Function Documentation

io::version_id io::legacy_reader::input_version_id (  )  [virtual]

Returns the serialization version id that was stored with the object currently being read.

Implements io::reader.

Definition at line 213 of file iolegacy.cc.

ref< io::serializable > io::legacy_reader::read_object ( const rutz::fstring name  )  [virtual]

Get a nub::ref associated with the tag name. A new object of the appropriate type will be created and inserted into the nub::objectdb, if necessary.

Implements io::reader.

Definition at line 302 of file iolegacy.cc.

References read_weak_object().

Referenced by read_root().

soft_ref< io::serializable > io::legacy_reader::read_weak_object ( const rutz::fstring name  )  [virtual]

Get a soft_ref associated with the tag name. If no such object exists, a null object is returned; otherwise, a new object of the appropriate type will be created and inserted into the nub::objectdb, if necessary.

Implements io::reader.

Definition at line 309 of file iolegacy.cc.

Referenced by read_object().

void io::legacy_reader::read_owned_object ( const rutz::fstring name,
nub::ref< io::serializable obj 
) [virtual]

Restore the state of the io object obj, associated with the tag name. The io::reader will not create a new object, but will use the io* provided here.

Implements io::reader.

Definition at line 329 of file iolegacy.cc.

Referenced by read_root().

void io::legacy_reader::read_base_class ( const rutz::fstring base_class_name,
nub::ref< io::serializable base_part 
) [virtual]

Read the named base class into the io object obj, which should be arranged to point or refer to the appropriate base class part of the object. In particular, obj's virtual functions must NOT call the fully derived versions. This effect can be best accomplished with an io::proxy.

Implements io::reader.

Definition at line 338 of file iolegacy.cc.

ref< io::serializable > io::legacy_reader::read_root ( io::serializable root = 0  )  [virtual]

Restore an entire object hierarchy, starting with the root object. If root is non-null, the function will use root as the root object. Otherwise the function will create a new root object. In either case, the function returns the object that was actually used as the root object.

Implements io::reader.

Definition at line 350 of file iolegacy.cc.

References nub::object::obj_typename(), read_object(), and read_owned_object().

int io::reader::ensure_version_id ( const char *  name,
io::version_id  lowest_supported_version,
const char *  msg,
const rutz::file_pos pos 
) [inherited]


The documentation for this class was generated from the following files:

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:56:18 2008 by Doxygen version 1.5.5.