#include <udoc.hpp>
Public Member Functions | |
| virtual UDoc * | create (const UStr &name) |
| creates an empty document. | |
| virtual UDoc * | load (const UStr &name, const UStr &buffer) |
| loads a document from a buffer in memory. | |
| virtual UDoc * | read (const UStr &filename) |
| reads a document from a file. | |
| virtual int | getStatus () const |
| status of the last (read/load/create) operation. | |
| virtual void | saveErrors (bool) |
| virtual UStr * | getErrors () const |
| return last errors messages if saveErrors() was set to true. | |
| virtual UDocCreator * | getCreator (const UStr &type) |
| returns the creator for this type (if any, null otherwise). | |
| virtual UDocCreator * | getDefaultCreator () |
| returns the default document creator. | |
| virtual void | addCreator (const UStr &type, UDocCreator &) |
| adds a document creator. | |
| virtual void | setDefaultCreator (UDocCreator &) |
| changes the creator that is used when the document type is unknown. | |
Static Public Member Functions | |
| static UDocFactory & | getDefaultFactory () |
| returns the default factory for reading/creating documents. | |
Protected Types | |
|
typedef std::map< const UStr *, UDocCreator *, Comp > | Map |
Protected Attributes | |
| Map | rmap |
| UDocCreator * | default_creator |
| int | stat |
| uptr< UStr > | errors |
See class UDoc for info on "documents".
creates an empty document.
creates an instance of the appropriate UDoc subclass depending on 'name' suffix.
| UDocCreator * ubit::UDocFactory::getCreator | ( | const UStr & | type | ) | [virtual] |
returns the creator for this type (if any, null otherwise).
by convention, the 'type' is the suffix of the file (e.g. "html", "txt", "cpp" ...)
Note: certains creators (such as the HTML or XML creators) have specific options. This function provides a mean to retrieve the actual creator and to change its options.
| UStr * ubit::UDocFactory::getErrors | ( | ) | const [virtual] |
return last errors messages if saveErrors() was set to true.
errors are printed on stderr otherwise.
| int ubit::UDocFactory::getStatus | ( | ) | const [virtual] |
status of the last (read/load/create) operation.
value is:
loads a document from a buffer in memory.
creates an instance of the appropriate UDoc subclass depending on 'name' suffix.
reads a document from a file.
reads and creates an instance of the appropriate UDoc subclass depending on 'filename' suffix.
1.4.7