Document::DoWrite

Section: ET++ method description (n)
Updated: automatically Fri Mar 15 14:13:05 1991
Index Return to Main Contents
 

NAME

Document::DoWrite - instance method  

TEMPLATE

void DoWrite(ostream & outputStream, int saveOption)  

SPECIFIERS

public virtual  

DESCRIPTION

DoWrite is called by the method Store and must write the document's data to the outputStream. The data can be written by means of the Object Input/Output Mechanism (see class Object and cookbook Object Input/Output).
The overridden method should always call the base class' method first so that Document::DoWrite can write a special line including the instvar docType. This allows the class FileType to determine the type of files. The line looks like this: @!DOCUMENT_TYPE ApplicationName.
An example for implementing this method:

class MyDocument : public Document {
    Object *op;        // some data
    ...
};

void MyDocument::DoWrite(ostream & os, int saveOption)
{
    Document::DoWrite(os, saveOption);

    os << op;
}


The saveOption normally has no meaning and contains 0. A different saveOption is only possible if DoWrite is triggered by the method SaveAs. SaveAs gets the save option from the save file dialog which is created by the method MakeFileDialog. This method must be overridden to create a special file dialog allowing the user to specify other save options (see class FileDialog).
DoWrite can then use the saveOption to choose a different output format, e.g. to write the data in pure ASCII format instead of the ET++ Object I/O format.
See also the tree example application. Method is always overridden.  

ARGUMENTS

ostream & outputStream

the output stream where to write the document's data
int saveOption

a user-defined option
 

RETURN ARGUMENT

void

 

CATEGORIES

input/output, overrider interface

 

FIRST DEFINITION

class Document  

FILES

implementation:
Document.C


 

Index

NAME
TEMPLATE
SPECIFIERS
DESCRIPTION
ARGUMENTS
RETURN ARGUMENT
CATEGORIES
FIRST DEFINITION
FILES

This document was created by man2html, using the manual pages.
Time: 00:40:28 GMT, March 30, 2022