![]() |
The Simons
|
#include <Writer.h>
Inheritance diagram for Writer:
The Writer class is an intermediate class in the streams hierarchy that serves as the main interface for encoding Object data. The descendants of Writer include XMLWriter, CSVWriter and HTMLWriter. A Writer wraps up an Output stream, to which it sends its encoded data. It defines the interface for serialising root and branch Objects in an encoded form, providing put() to serialise a root object and all Objects reachable from it; and putField() to serialise a branch Object stored as the named field of some other Object.
Public Member Functions | |
Writer () | |
Construct a standard Writer stream. | |
virtual | ~Writer () |
Release an unused Writer stream. | |
Writer (StringID) | |
Construct a file Writer stream. | |
OutputID | stream () const |
Return the wrapped Output stream. | |
virtual WriterID | put (ObjectID) |
Write out an Object in a serially-encoded, textual representation. | |
virtual WriterID | putField (StringID, ObjectID) |
Write out the Object named by this field in a serially-encoded textual representation. | |
Protected Member Functions | |
Writer (const Writer &) | |
Copy another Writer stream. | |
virtual FileStreamID | fileStream () const |
Return the wrapped FileStream. | |
Protected Attributes | |
TextOutputID | output |
The underlying TextOutput stream. |
|
Copy another Writer stream. Required by C++ to ensure that copying an Writer faithfully copies a FormatStream. Constructs a shallow copy of the other Writer, sharing the underlying TextOutput stream.
|
|
Construct a standard Writer stream. Constructs a Writer whose output is the standard TextOutput stream, initially closed.
|
|
Release an unused Writer stream. Performs all closing actions to disconnect from the underlying filesystem. |
|
Construct a file Writer stream. Constructs a Writer stream whose output is the TextOutput stream named by the file path name.
|
|
Return the wrapped FileStream. This is the same as the Output stream, but the returned type is more general. This method is used by FormatStream to access the abstract wrapped FileStream.
Reimplemented from FormatStream. |
|
Write out an Object in a serially-encoded, textual representation. This is the top-level method for serializing an Object cluster. The Object and all of its connected dependents will be written to this Writer stream, such that a similar Reader stream may later read in the Object and its dependents and rebuild an equivalent Object cluster. The particular textual encoding is determined by subclasses. This top-level method writes out any header information and then calls putField("root", object) to write the Object cluster. A WriteFailure exception may be raised if writing fails.
Reimplemented in XMLWriter. |
|
Write out the Object named by this field in a serially-encoded textual representation. 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 encoding protocol must at least write out the Object's type and identity. If the Object was previously written, that is all. Otherwise, writeOn(this) should be invoked on the Object, which calls putField() recursively for each of the Object's fields.
Reimplemented in XMLWriter. |
|
Return the wrapped Output stream. This method is used by Value and String objects, which are leaf-nodes in any object graph, to access the more basic Output stream. These leaf-node objects write their contents directly as text, in their writeOn() method.
|
|
The underlying TextOutput stream.
|