ubit::UDocFactory Class Reference

Document Factory: use this class to read documents. More...

#include <udoc.hpp>

List of all members.

Public Member Functions

virtual UDoccreate (const UStr &name)
 creates an empty document.
virtual UDocload (const UStr &name, const UStr &buffer)
 loads a document from a buffer in memory.
virtual UDocread (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 UStrgetErrors () const
 return last errors messages if saveErrors() was set to true.
virtual UDocCreatorgetCreator (const UStr &type)
 returns the creator for this type (if any, null otherwise).
virtual UDocCreatorgetDefaultCreator ()
 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 UDocFactorygetDefaultFactory ()
 returns the default factory for reading/creating documents.

Protected Types

typedef std::map< const UStr *,
UDocCreator *, Comp > 
Map

Protected Attributes

Map rmap
UDocCreatordefault_creator
int stat
uptr< UStrerrors


Detailed Description

Document Factory: use this class to read documents.

See class UDoc for info on "documents".


Member Function Documentation

UDoc * ubit::UDocFactory::create ( const UStr name  )  [virtual]

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:

UDoc * ubit::UDocFactory::load ( const UStr name,
const UStr buffer 
) [virtual]

loads a document from a buffer in memory.

creates an instance of the appropriate UDoc subclass depending on 'name' suffix.

UDoc * ubit::UDocFactory::read ( const UStr filename  )  [virtual]

reads a document from a file.

reads and creates an instance of the appropriate UDoc subclass depending on 'filename' suffix.


The documentation for this class was generated from the following files:
Generated on Mon Jan 29 00:20:48 2007 for Ubit by  doxygen 1.4.7