Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::Persistable Class Reference

Persistable is a simple interface used to indicate that an object can read or write itself to an input or output stream. More...

#include <vcf/FoundationKit/Persistable.h>

Inheritance diagram for VCF::Persistable:

VCF::AbstractImage VCF::BinaryPersistable VCF::DateTime VCF::DefaultListModel VCF::Dictionary VCF::Frame::State VCF::Rect VCF::GrayScaleImage VCF::OSXImage VCF::Win32Image VCF::XCBGrayscaleImagePeer VCF::XCBImagePeer VCF::PropertyListing VCF::Win32GrayScaleImage List of all members.

Public Member Functions

virtual ~Persistable ()
virtual void saveToStream (OutputStream *stream, const MIMEType &type=MIMEType())=0
 Write the object to the specified output stream.
virtual void loadFromStream (InputStream *stream, const MIMEType &type=MIMEType())=0
 Read the object from the specified input stream.

Detailed Description

Persistable is a simple interface used to indicate that an object can read or write itself to an input or output stream.

This assumes that the object has been instantiated already.

Reading the object from a stream is done by implementing the loadFromStream method, and writing the object is accomplished by implementing the saveToStream method.

In both cases (loadFromStream() or saveToStream()) an optional type may be passed which indicates to the object what kind of data may be present in the stream or what kind of preferred data should be written to the stream. The default value for this parameter is empty (see MIMEType::isEmpty() ) and can be ignored if you don't require it.

See also:
MIMEType

OutputStream

InputStream


Constructor & Destructor Documentation

virtual VCF::Persistable::~Persistable  )  [inline, virtual]
 


Member Function Documentation

virtual void VCF::Persistable::loadFromStream InputStream stream,
const MIMEType type = MIMEType()
[pure virtual]
 

Read the object from the specified input stream.

Parameters:
InputStream 
MIMEType indicates how to read the data from the stream. For example, if the object was some sort of image object, and had an array of pixels, then the type might indicate how the data in the stream should be interpreted, such as the JPEG format ("image/jpeg"), or the PNG format ("image/png").

Implemented in VCF::DateTime, VCF::Dictionary, VCF::PropertyListing, VCF::AbstractImage, VCF::Rect, VCF::BinaryPersistable, VCF::DefaultListModel, and VCF::Frame::State.

virtual void VCF::Persistable::saveToStream OutputStream stream,
const MIMEType type = MIMEType()
[pure virtual]
 

Write the object to the specified output stream.

Parameters:
OutputStream 
MIMEType indicates how the object should write it's data. For example, if the object was some sort of image object, and had an array of pixels, then the type might indicate what kind of image type to write the data in, such as the JPEG format ("image/jpeg"), or the PNG format ("image/png").

Implemented in VCF::DateTime, VCF::Dictionary, VCF::PropertyListing, VCF::AbstractImage, VCF::Rect, VCF::BinaryPersistable, VCF::DefaultListModel, and VCF::Frame::State.


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information