Views
Application Framework Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvDvSerializable Class Reference

Application Framework serializable objects base class. More...

#include <ilviews/appframe/serializ.h>

Inheritance diagram for IlvDvSerializable:
IlvDvActionDescriptor IlvDvCommand IlvDvDocTemplate IlvDvDocument IlvDvDocViewInterface IlvDvFileInfo IlvDvActionGadgetItem IlvDvManagerDocument IlvDvProjectDocument IlvDvTextDocument IlvDvFormView IlvDvHierarchicalSheetView IlvDvListView IlvDvMatrixView IlvDvSheetView IlvDvTextView IlvDvTreeView IlvDvView

Public Member Functions

virtual void serialize (IlvDvStream &stream)
 Serializes the object in the stream stream.
Typically, the body of the method has the following form:
More...
 

Detailed Description

Application Framework serializable objects base class.

Library: ilvappframe

IlvDvSerializable is a root base class shared by most Application Framework classes.
Application Framework provides a serialization mechanism that allows an object of a class inheriting from IlvDvSerializable class to be * saved in a stream and to be dynamically created and loaded from a stream.
To do this, the inheriting class must first use the macro IlvDvDeclareDynCreate(); in its header file and the following macros in the implementation file, in this order:

IlvDvPreRegisterDynClass(<classname>, <superClassname>);
IL_BEGINMODULEINITDEF(<moduleName>)
IlvDvPostRegisterDynClass(<classname>, <superClassname>);
IL_ENDMODULEINITDEF(<moduleName>)

Then, it must redefine the method serialize(IlvDvStream& stream) to serialize its data.

Member Function Documentation

◆ serialize()

virtual void IlvDvSerializable::serialize ( IlvDvStream stream)
virtual

Serializes the object in the stream stream.
Typically, the body of the method has the following form:

void
MyClass::serialize(IlvDvStream& stream) {
Superclass::serialize(stream);
if (stream.isSaving()) {
// Here, write your persistent data
} else {
// Here, read data from stream
}
}

There are two ways to load and save data.
One way is to use istream or ostream objects given by methods istream* getInStream() const and ostream* getOutStream() const from the IlvDvStream class directly.
The other way, which is usually easier, is to use specific serialization methods provided by the IlvDvStream class.
This class provides serialization operators for basic types (IlInt, IlBoolean, and so on), and provides methods that make it easy to save a string, a bitmap, an IlvDvSerializable object, and an array of IlvDvSerializable objects.

Reimplemented in IlvDvProjectDocument, IlvDvFileInfo, IlvDvManagerDocument, IlvDvGrapherDocument, IlvDvDocument, IlvDvTextDocument, IlvDvDocViewInterface, and IlvDvDocTemplate.

IlvDvStream
Application Framework stream base class.
Definition: stream.h:73
IlvDvStream::isSaving
IlBoolean isSaving() const
Returns IlTrue if the stream is used for saving data.
Definition: stream.h:340