OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Streams can provide only simple serial access to data.
In cases where a document contains multimedia files, database tables, or other complex data, you probably want more sophisticated access methods. For this purpose, TDocument uses two access functions, TDocument::Open() and TDocument::Close(), that you can override to define your own opening and closing behavior.
The TDocument version of Open performs no actions; it always returns true. You can write your own version of Open to work however you want. There are no restrictions placed on how you define opening a document. You can make it as simple as you like or as complex as necessary. Open lets you open a document and keep it open, instead of opening the document only on demand from one of the document's stream objects.
The TDocument version of Close provides a little more functionality than does Open. It checks any existing children of your document and tries to close them before closing your document. If you provide your own Close, the first thing you should do in that function is call the TDocument version of Close to ensure that all children have been closed before you close the parent document. Other than this one restriction, you are free to define the implementation of the Close function. Just as with Open, Close lets you close a document when you want it closed, as opposed to permitting the document's stream objects to close the document.