Rocket::Core::Factory Class Reference
#include <Factory.h>
|
Static Public Member Functions |
|
static bool | Initialise () |
| | Initialise the element factory.
|
|
static void | Shutdown () |
| | Cleanup and shutdown the factory.
|
| static ContextInstancer * | RegisterContextInstancer (ContextInstancer *instancer) |
| static Context * | InstanceContext (const String &name) |
| static ElementInstancer * | RegisterElementInstancer (const String &name, ElementInstancer *instancer) |
| static ElementInstancer * | GetElementInstancer (const String &tag) |
| static Element * | InstanceElement (Element *parent, const String &instancer, const String &tag, const XMLAttributes &attributes) |
| static bool | InstanceElementText (Element *parent, const String &text) |
| static bool | InstanceElementStream (Element *parent, Stream *stream) |
| static ElementDocument * | InstanceDocumentStream (Rocket::Core::Context *context, Stream *stream) |
| static DecoratorInstancer * | RegisterDecoratorInstancer (const String &name, DecoratorInstancer *instancer) |
| static Decorator * | InstanceDecorator (const String &name, const PropertyDictionary &properties) |
| static FontEffectInstancer * | RegisterFontEffectInstancer (const String &name, FontEffectInstancer *instancer) |
| static FontEffect * | InstanceFontEffect (const String &name, const PropertyDictionary &properties) |
| static StyleSheet * | InstanceStyleSheetString (const String &string) |
| static StyleSheet * | InstanceStyleSheetFile (const String &file_name) |
| static StyleSheet * | InstanceStyleSheetStream (Stream *stream) |
|
static void | ClearStyleSheetCache () |
| | Clears the style sheet cache. This will force style sheets to be reloaded.
|
| static EventInstancer * | RegisterEventInstancer (EventInstancer *instancer) |
| static Event * | InstanceEvent (Element *target, const String &name, const Dictionary ¶meters, bool interruptible) |
| static EventListenerInstancer * | RegisterEventListenerInstancer (EventListenerInstancer *instancer) |
| static EventListener * | InstanceEventListener (const String &value) |
Detailed Description
The
Factory contains a registry of instancers for different types.
All instantiation of these rocket types should go through the factory so that scripting API's can bind in new types.
- Author:
- Lloyd Weehuizen
Member Function Documentation
Registers the instancer to use when instancing contexts.
- Parameters:
-
| [in] | instancer | The new context instancer. |
| Context * Rocket::Core::Factory::InstanceContext |
( |
const String & |
name |
) |
[static] |
Instances a new context.
- Parameters:
-
| [in] | name | The name of the new context. |
- Returns:
- The new context, or NULL if no context could be created.
Registers an element instancer that will be used to instance an element when the specified tag is encountered.
- Parameters:
-
| [in] | name | Name of the instancer; elements with this as their tag will use this instancer. |
| [in] | instancer | The instancer to call when the tag is encountered. |
- Returns:
- The added instancer if the registration was successful, NULL otherwise.
Returns the element instancer for the specified tag.
- Parameters:
-
| [in] | tag | Name of the tag to get the instancer for. |
- Returns:
- The requested element instancer, or NULL if no such instancer is registered.
Instances a single element.
- Parameters:
-
| [in] | parent | The parent of the new element, or NULL for a root tag. |
| [in] | instancer | The name of the instancer to create the element with. |
| [in] | tag | The tag of the element to be instanced. |
| [in] | attributes | The attributes to instance the element with. |
- Returns:
- The instanced element, or NULL if the instancing failed.
| bool Rocket::Core::Factory::InstanceElementText |
( |
Element * |
parent, |
|
|
const String & |
text | |
|
) |
| | [static] |
Instances a single text element containing a string. The string is assumed to contain no RML markup, but will be translated and therefore may have some introduced. In this case more than one element may be instanced.
- Parameters:
-
| [in] | parent | The element any instanced elements will be parented to. |
| [in] | text | The text to instance the element (or elements) from. |
- Returns:
- True if the string was parsed without error, false otherwise.
| bool Rocket::Core::Factory::InstanceElementStream |
( |
Element * |
parent, |
|
|
Stream * |
stream | |
|
) |
| | [static] |
Instances an element tree based on the stream.
- Parameters:
-
| [in] | parent | The element the stream elements will be added to. |
| [in] | stream | The stream to read the element RML from. |
- Returns:
- True if the stream was parsed without error, false otherwise.
Instances a document from a stream.
- Parameters:
-
| [in] | context | The context that is creating the document. |
| [in] | stream | The stream to instance from. |
- Returns:
- The instanced document, or NULL if an error occurred.
Registers an instancer that will be used to instance decorators.
- Parameters:
-
| [in] | name | The name of the decorator the instancer will be called for. |
| [in] | instancer | The instancer to call when the decorator name is encountered. |
- Returns:
- The added instancer if the registration was successful, NULL otherwise.
Attempts to instance a decorator from an instancer registered with the factory.
- Parameters:
-
| [in] | name | The name of the desired decorator type. |
| [in] | properties | The properties associated with the decorator. |
- Returns:
- The newly instanced decorator, or NULL if the decorator could not be instanced.
Registers an instancer that will be used to instance font effects.
- Parameters:
-
| [in] | name | The name of the font effect the instancer will be called for. |
| [in] | instancer | The instancer to call when the font effect name is encountered. |
- Returns:
- The added instancer if the registration was successful, NULL otherwise.
Attempts to instance a font effect from an instancer registered with the factory.
- Parameters:
-
| [in] | name | The name of the desired font effect type. |
| [in] | properties | The properties associated with the font effect. |
- Returns:
- The newly instanced font effect, or NULL if the font effect could not be instanced.
| StyleSheet * Rocket::Core::Factory::InstanceStyleSheetString |
( |
const String & |
string |
) |
[static] |
Creates a style sheet from a user-generated string.
- Parameters:
-
| [in] | string | The contents of the style sheet. |
- Returns:
- A pointer to the newly created style sheet.
| StyleSheet * Rocket::Core::Factory::InstanceStyleSheetFile |
( |
const String & |
file_name |
) |
[static] |
Creates a style sheet from a file.
- Parameters:
-
| [in] | file_name | The location of the style sheet file. |
- Returns:
- A pointer to the newly created style sheet.
| StyleSheet * Rocket::Core::Factory::InstanceStyleSheetStream |
( |
Stream * |
stream |
) |
[static] |
Creates a style sheet from an Stream.
- Parameters:
-
| [in] | stream | A pointer to the stream containing the style sheet's contents. |
- Returns:
- A pointer to the newly created style sheet.
Registers an instancer for all events.
- Parameters:
-
| [in] | instancer | The instancer to be called. |
- Returns:
- The registered instanced on success, NULL on failure.
| Event * Rocket::Core::Factory::InstanceEvent |
( |
Element * |
target, |
|
|
const String & |
name, |
|
|
const Dictionary & |
parameters, |
|
|
bool |
interruptible | |
|
) |
| | [static] |
Instance and event object
- Parameters:
-
| [in] | target | Target element of this event. |
| [in] | name | Name of this event. |
| [in] | parameters | Additional parameters for this event. |
| [in] | interruptible | If the event propagation can be stopped. |
- Returns:
- The instanced event.
Register the instancer to be used for all event listeners.
- Returns:
- The registered instancer on success, NULL on failure.
Instance an event listener with the given string. This is used for instancing listeners for the on* events from RML.
- Parameters:
-
| [in] | value | The parameters to the event listener. |
- Returns:
- The instanced event listener.
The documentation for this class was generated from the following files:
- Include/Rocket/Core/Factory.h
- Source/Core/Factory.cpp