Main Page   Class Hierarchy   Compound List   File List   Compound Members  

Serializable Class Reference

A Readable and Writeable Interface. More...

#include <Serializable.h>

Inheritance diagram for Serializable:

Inheritance graph
[legend]
Collaboration diagram for Serializable:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual void Save (const string &filename) const
 Save to a file. More...

virtual void Load (const string &filename) throw (FileNotFoundException, UnknownException)
 Load a file. More...


Protected Methods

void OpenFile (ifstream &fin, const string &filename) throw (FileNotFoundException)
 This opens a file. More...


Detailed Description

A Readable and Writeable Interface.

An object who implements Serializable can Save and Load itself. In order to use this interface properly, a class must implement the Readable::Read() and Writeable::ToString() functions. That class will get the operators << and >>, Save, and Load for free.


Member Function Documentation

void Serializable::Load ( const string & filename ) throw (FileNotFoundException, UnknownException) [inline, virtual]
 

Load a file.

This tries to open a file and read from it. If the file is not found an exception is thrown. It is up to the caller to catch this. An unknown exception could also be thrown if something unusual happens.

void Serializable::OpenFile ( ifstream & fin,
const string & filename ) throw (FileNotFoundException) [inline, protected]
 

This opens a file.

OpenFile tries to open a files and throws an exception if it can't

See also:
Load()

void Serializable::Save ( const string & filename ) const [inline, virtual]
 

Save to a file.

This opens the file and calls the Writeable::ToString() function and writes that data to the file


The documentation for this class was generated from the following file:
Generated at Wed May 2 00:24:45 2001 for API by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001