![]() |
The Simons
|
#include <Reader.h>
Inheritance diagram for Reader:
The Reader class is an intermediate class in the streams hierarchy that serves as the main interface for decoding Object data. The descendants of Reader include XMLReader, CSVReader and CGIReader. A Reader wraps up an Input stream, from which it obtains its encoded data. It defines the interface for restoring root and branch Objects from their encoded forms, providing get() to reconstruct a root Object and all Objects reachable from it; and getField() to reconstruct a branch Object stored as the named field of some other Object.
Public Member Functions | |
Reader () | |
Construct a standard Reader stream. | |
virtual | ~Reader () |
Release an unused Reader stream. | |
Reader (StringID) | |
Construct a file Reader stream. | |
virtual Natural | multiple () const |
Return the field multiple. | |
InputID | stream () const |
Return the wrapped Input stream. | |
virtual ReaderID | get (ObjectID &) |
Read in an Object from its serially-encoded, textual representation. | |
virtual ReaderID | getField (StringID, ObjectID &) |
Read in the Object named by this field from its serially-encoded textual representation. | |
Protected Member Functions | |
Reader (const Reader &) | |
Copy another Reader stream. | |
virtual FileStreamID | fileStream () const |
Return the wrapped FileStream. | |
Protected Attributes | |
TextInputID | input |
The underlying TextInput stream. |
|
Copy another Reader stream. Required by C++ to ensure that copying an Reader faithfully copies a FormatStream. Constructs a shallow copy of the other Reader, sharing the underlying TextInput stream.
|
|
Construct a standard Reader stream. Constructs a Reader whose input is the standard TextInput stream, initially closed.
|
|
Release an unused Reader stream. Performs all closing actions to disconnect from the underlying filesystem. |
|
Construct a file Reader stream. Constructs a Reader stream whose input is the TextInput stream named by the file path name.
|
|
Return the wrapped FileStream. This is the same as the Input stream, but the returned type is more general. This method is used by FormatStream to access the abstract wrapped FileStream.
Reimplemented from FormatStream. |
|
Read in an Object from its serially-encoded, textual representation. This is the top-level method for reconstructing an Object cluster. The argument variable will be initialised with an Object and all of its connected dependents, as this Reader decodes the serialized textual representation, which was previously encoded using a Writer stream. The expected textual encoding is determined by subclasses. This top-level method reads in any header information and then calls getField("root", variable) to read the Object cluster. A ReadFailure exception may be raised if reading fails.
Reimplemented in XMLReader. |
|
Read in the Object named by this field from its serially-encoded textual representation. The argument variable will be initialised with an Object and all of its connected dependents. This method is abstract and must be implemented in all subclasses, which support particular textual encodings, such as XML-format or CSV-format encodings, for example. The decoding protocol must at least read in the Object's type and identity. If the identity was previously read, the corresponding object should be returned. Otherwise, a new instance of the type should be created, on which readOn(this) is invoked, which calls getField() recursively for each of the Object's fields.
|
|
Return the field multiple. Attribute fields have a multiple of one. The element field of a Collection has a variable multiple, ranging from zero to many. This method is used by Collection in readOn() to determine how many element fields to expect. This method is abstract in Reader.
Reimplemented in XMLReader. |
|
Return the wrapped Input stream. This method is used by Value and String objects, which are leaf-nodes in any object graph, to access the more basic Input stream. These leaf-node objects read their contents directly as text, in their readOn() method.
|
|
The underlying TextInput stream.
|