#include <Serializable.h>
Inheritance diagram for Serializable:
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... |
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.
|
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. |
|
This opens a file. OpenFile tries to open a files and throws an exception if it can't
|
|
Save to a file. This opens the file and calls the Writeable::ToString() function and writes that data to the file |