io::reader Class Reference

#include <io/reader.h>

Inheritance diagram for io::reader:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~reader () throw ()
 Virtual destructor allows correct destruction of subclasses.
int ensure_version_id (const char *name, io::version_id lowest_supported_version, const char *msg, const rutz::file_pos &pos)
virtual io::version_id input_version_id ()=0
virtual char read_char (const rutz::fstring &name)=0
 Read the char attribute associated with the tag name.
virtual int read_int (const rutz::fstring &name)=0
 Read the int attribute associated with the tag name.
virtual bool read_bool (const rutz::fstring &name)=0
 Read the bool attribute associated with the tag name.
virtual double read_double (const rutz::fstring &name)=0
 Read the double attribute associated with the tag name.
virtual void read_value_obj (const rutz::fstring &name, rutz::value &v)=0
 Read the rutz::value attribute associated with the tag name.
virtual void read_byte_array (const rutz::fstring &name, rutz::byte_array &data)=0
 Read the raw data array associated with the tag name.
virtual nub::ref
< io::serializable
read_object (const rutz::fstring &name)=0
virtual nub::soft_ref
< io::serializable
read_weak_object (const rutz::fstring &name)=0
virtual void read_owned_object (const rutz::fstring &name, nub::ref< io::serializable > obj)=0
virtual void read_base_class (const rutz::fstring &base_class_name, nub::ref< io::serializable > base_part)=0
virtual nub::ref
< io::serializable
read_root (io::serializable *root=0)=0
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)=0
 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.


Detailed Description

io::reader provides the interface that io objects use to restore their state in a read_from() implementation. It provides the inverse operations to those in io::writer. To reconstruct an object tree, a client should call read_root() on the root object in that tree. Subclasses of io::reader will implement this interface using different back ends for the actual storage medium, for example, an ASCII text file, an on-screen dialog box, a relational database, etc.

Definition at line 70 of file reader.h.


Member Function Documentation

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

virtual io::version_id io::reader::input_version_id (  )  [pure virtual]

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

Implemented in io::legacy_reader.

Referenced by ensure_version_id(), and FieldContainer::readFieldsFrom().

virtual nub::ref<io::serializable> io::reader::read_object ( const rutz::fstring name  )  [pure 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.

Implemented in io::legacy_reader.

Referenced by FileWriteEvent::read_from(), and io::read_utils::read_object_seq().

virtual nub::soft_ref<io::serializable> io::reader::read_weak_object ( const rutz::fstring name  )  [pure 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.

Implemented in io::legacy_reader.

virtual void io::reader::read_owned_object ( const rutz::fstring name,
nub::ref< io::serializable obj 
) [pure 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.

Implemented in io::legacy_reader.

Referenced by GenericEvent::read_from(), ExptDriver::read_from(), EventResponseHdlr::read_from(), and GxShapeKit::read_from().

virtual void io::reader::read_base_class ( const rutz::fstring base_class_name,
nub::ref< io::serializable base_part 
) [pure 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.

Implemented in io::legacy_reader.

Referenced by GenericEvent::read_from(), FileWriteEvent::read_from(), TimingHandler::read_from(), MorphyFace::read_from(), MaskHatch::read_from(), Jitter::read_from(), House::read_from(), GaborArray::read_from(), Gabor::read_from(), FixPt::read_from(), Fish::read_from(), Face::read_from(), ExptDriver::read_from(), Block::read_from(), GxText::read_from(), and GxPixmap::read_from().

virtual nub::ref<io::serializable> io::reader::read_root ( io::serializable root = 0  )  [pure 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.

Implemented in io::legacy_reader.


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:19 2008 by Doxygen version 1.5.5.