Cross-Platform C++

ot::sax
class XMLReaderFactory

#include "ot/sax/XMLReaderFactory.h"

ot::ManagedObject Factory class for creating an XMLReader.

This class contains a static function for creating an XMLReader: CreateXMLReader(). This function delegates the create request to the registered XMLReaderFactory instance thereby enabling the application to register a factory object and, in doing so, control the kind of XMLReader produced.

If an instance of XMLReaderFactory is not registered by the application, an instance is created automatically the first time CreateXMLReader() or GetInstance() is called.

    RefPtr<XMLReader> rpReader = XMLReaderFactory::CreateXMLReader();




Method Summary
static RefPtr< XMLReader > CreateXMLReader()
         Static function to create an instance of an XMLReader.
protected  virtual RefPtr< XMLReader > doCreate() const
         Creates an instance of XMLReader.
static RefPtr< XMLReaderFactory > GetInstance()
         Returns the currently registered XMLReaderFactory.
static void SetInstance(XMLReaderFactory* pFactory)
         Allows an application to register a custom XMLReaderFactory object which will be used to create instances of XMLReader.

Methods inherited from class ot::ManagedObject
addRef, getRefCount, onFinalRelease, operator=, release

Method Detail

CreateXMLReader

static RefPtr< XMLReaderCreateXMLReader()
Static function to create an instance of an XMLReader. This static function simply delegates the request to the currently registered XMLReaderFactory object's doCreate() method. If the application has not registered an instance of XMLReaderFactory, a default factory is registered automatically.

Multi-threaded considerations:
Can safely be called from multiple concurrent threads.

doCreate

protected virtual RefPtr< XMLReaderdoCreate() const
Creates an instance of XMLReader. An application may register a class derived from XMLReaderFactory to create whatever derivative of XMLReader it requires.


GetInstance

static RefPtr< XMLReaderFactory > GetInstance()
Returns the currently registered XMLReaderFactory. If a factory has not yet been registered, this method creates a default XMLReaderFactory and registers that.

Multi-threaded considerations:
Can safely be called from multiple concurrent threads.

SetInstance

static void SetInstance(XMLReaderFactory* pFactory)
Allows an application to register a custom XMLReaderFactory object which will be used to create instances of XMLReader. Like other OpenTop global objects, XMLReaderFactory is a ManagedObject. This enables the passed object to be registered with the system's ObjectManager, thereby freeing the application from having to manage the lifetime of the factory object. In other words, the application does not need to maintain the object's reference-count once it has been registered.

A typical application may do the following:-

   XMLReaderFactory::SetInstance(new MyXMLReaderFactory);

Parameters:
pFactory - a pointer to an instance of XMLReaderFactory or null to unregister the currently registered factory.
Multi-threaded considerations:
Can safely be called from multiple concurrent threads.


Cross-Platform C++

Found a bug or missing feature? Please email us at support@elcel.com

Copyright © 2000-2003 ElCel Technology   Trademark Acknowledgements