Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Input/Output class. More...
#include <ilviews/graphics/io.h>
Inherits IlvBaseInputFile.
Inherited by IlvViewInputFile.
Public Member Functions | |
IlvInputFile (istream &stream) | |
Constructor. | |
virtual void | commentRead (const char *commentString) |
Called when a comment is encountered. | |
virtual void | graphicObjectsRead (IlUInt nGraphicObjects) |
Called just after the graphic objects have been read. | |
virtual void | palettesRead (IlUInt nPalettes) |
Called just after the palettes have been read. | |
virtual IlBoolean | parseBlock (const char *blockName) |
Parses a block of the input file. | |
IlvGraphic * | readNext () |
Reads a new object from the stream. | |
virtual IlvGraphic * | readObject () |
Read an object from the stream. | |
IlvGraphic * | readObjectBlock (IlInt &number) |
Reads a complete block describing an object. | |
virtual IlvGraphic *const * | readObjects (IlvDisplay *display, IlUInt &count) |
Reads all the objects from the stream. | |
virtual const char * | typeOf () const |
Returns the type of this file reader. | |
virtual void | unknownLineRead (const char *string) |
Called when an unknown line has been read. | |
Static Public Member Functions | |
static IlvGraphic * | ReadObject (IlvDisplay *display, const char *filename) |
Returns the first graphic object of the specified file. |
Input/Output class.
Library: views
The IlvInputFile
class is the main class for reading objects from a stream.
IlvInputFile::IlvInputFile | ( | istream & | stream | ) |
Constructor.
This constructor initializes a new IlvInputFile
object that is ready to read from the given stream object.
stream | The input stream. |
virtual void IlvInputFile::commentRead | ( | const char * | commentString | ) | [virtual] |
Called when a comment is encountered.
Called when the file reader finds a comment, that is, a line that begins with two slash characters (//
). The rest of the line is passed in the parameter commentString
.
commentString | The comment. |
virtual void IlvInputFile::graphicObjectsRead | ( | IlUInt | nGraphicObjects | ) | [virtual] |
Called just after the graphic objects have been read.
Called when all the graphic objects stored in this file have been read, so that you can perform operations on them. The total number of objects that have been read is available in the parameter nGraphicObjects
.
nGraphicObjects | The number of graphic objects read. |
virtual void IlvInputFile::palettesRead | ( | IlUInt | nPalettes | ) | [virtual] |
Called just after the palettes have been read.
Called just after the palettes have been read from the stream. The number of palettes read is indicated by nPalettes
.
nPalettes | The number of palettes read. |
virtual IlBoolean IlvInputFile::parseBlock | ( | const char * | blockName | ) | [virtual] |
Parses a block of the input file.
Called for each block that is read in this input file. It is designed as virtual so that you can add your own blocks in the Rogue Wave Views data files. The blocks are written by the associated IlvOutputFile
(usually in the IlvOutputFile::saveMoreInfo
function). Each block is identified by a word called the block identifier. This string must be the first word of a new line (which is usually the case since previous blocks should end with a new line), and must start with a letter. The Rogue Wave Views convention is to have every block identifier be a concatenation of capitalized words.
The block identifier is provided in blockName
so that you can compare this string with that of your private block identifier. The input stream pointer is located just after the block identifier, so that you can start reading your block's data.
This function returns IlFalse
if no block identifier matches blockName
for that particular IlvInputFile
subclass. In your implementations, you should return the result of calling the parent class' parseBlock
function, so that parent classes can watch for their own block identifiers.
blockName | The block name. |
IlTrue
if the block was read, IlFalse
otherwise. IlvGraphic* IlvInputFile::readNext | ( | ) |
Reads a new object from the stream.
Reads a new object from the associated stream and returns that object. That is, it reads the palette index and the class name of the object from the stream; then the specific read
function for this class is called so it can read its own information to create a new object.
readNext
performs the opposite task of the operator<<
of the IlvOutputFile
class.
static IlvGraphic* IlvInputFile::ReadObject | ( | IlvDisplay * | display, | |
const char * | filename | |||
) | [static] |
Returns the first graphic object of the specified file.
display | The connection to the display. | |
filename | The file name. |
0
if the file does not contain any object or if the file cannot be opened. virtual IlvGraphic* IlvInputFile::readObject | ( | ) | [virtual] |
Read an object from the stream.
Reads a new object description by means of a call to the member function readObjectBlock
. It needs to be overloaded for you to get specific object information.
This operation is the exact opposite of the one performed by the member function IlvOutputFile::writeObject
of the IlvOutputFile
class.
The version of the member function readObject
that is defined for a given subtype of IlvInputFile
must strictly match the one you use for the subtype of the IlvOutputFile
class you used when saving the objects.
A typical implementation of the member function readObject
is:
IlvGraphic* SubTypeOfInputFile::readObject() { // Read whatever is saved before the object description block // by means of "getStream() >> ??" calls IlInt index; IlvGraphic* object = readObjectBlock(index); // Read whatever is saved after the object description block // by means of "getStream() >> ??" calls return object; }
IlvGraphic* IlvInputFile::readObjectBlock | ( | IlInt & | number | ) |
Reads a complete block describing an object.
Reads a complete block describing an object. It gets specific information for the object, and then calls the member function readNext
to actually create the object. The new object is then returned and number
is set to this object's index in the file.
number | The index of the object in the file. |
virtual IlvGraphic* const* IlvInputFile::readObjects | ( | IlvDisplay * | display, | |
IlUInt & | count | |||
) | [virtual] |
Reads all the objects from the stream.
Reads in a complete Rogue Wave Views file and returns an array of pointers to the created objects. You should never delete the array as it is internally maintained.
readObjects
performs the opposite task of the member function IlvOutputFile::saveObjects
used with the IlvOutputFile
class.
display | The connection to the display. | |
count | The size of the returned array. |
virtual const char* IlvInputFile::typeOf | ( | ) | const [virtual] |
Returns the type of this file reader.
Returns a string that contains the class name of this file reader. It is used only for message output purposes.
virtual void IlvInputFile::unknownLineRead | ( | const char * | string | ) | [virtual] |
Called when an unknown line has been read.
Called when a block identifier is expected and an invalid identifier is found. This happens if a block has just ended and the next line begins with a numerical value. The entire line is available in line
. This function is provided so you can still read data files that were produced with older versions of Rogue Wave Views that did not need block descriptors.
string | The unknown line. |
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.