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 ContextInstancerRegisterContextInstancer (ContextInstancer *instancer)
static ContextInstanceContext (const String &name)
static ElementInstancerRegisterElementInstancer (const String &name, ElementInstancer *instancer)
static ElementInstancerGetElementInstancer (const String &tag)
static ElementInstanceElement (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 ElementDocumentInstanceDocumentStream (Rocket::Core::Context *context, Stream *stream)
static DecoratorInstancerRegisterDecoratorInstancer (const String &name, DecoratorInstancer *instancer)
static DecoratorInstanceDecorator (const String &name, const PropertyDictionary &properties)
static FontEffectInstancerRegisterFontEffectInstancer (const String &name, FontEffectInstancer *instancer)
static FontEffectInstanceFontEffect (const String &name, const PropertyDictionary &properties)
static StyleSheetInstanceStyleSheetString (const String &string)
static StyleSheetInstanceStyleSheetFile (const String &file_name)
static StyleSheetInstanceStyleSheetStream (Stream *stream)
static void ClearStyleSheetCache ()
 Clears the style sheet cache. This will force style sheets to be reloaded.
static EventInstancerRegisterEventInstancer (EventInstancer *instancer)
static EventInstanceEvent (Element *target, const String &name, const Dictionary &parameters, bool interruptible)
static EventListenerInstancerRegisterEventListenerInstancer (EventListenerInstancer *instancer)
static EventListenerInstanceEventListener (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

ContextInstancer * Rocket::Core::Factory::RegisterContextInstancer ( ContextInstancer instancer  )  [static]

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.

ElementInstancer * Rocket::Core::Factory::RegisterElementInstancer ( const String name,
ElementInstancer instancer 
) [static]

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.

ElementInstancer * Rocket::Core::Factory::GetElementInstancer ( const String tag  )  [static]

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.

Element * Rocket::Core::Factory::InstanceElement ( Element parent,
const String instancer,
const String tag,
const XMLAttributes attributes 
) [static]

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.

ElementDocument * Rocket::Core::Factory::InstanceDocumentStream ( Rocket::Core::Context context,
Stream stream 
) [static]

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.

DecoratorInstancer * Rocket::Core::Factory::RegisterDecoratorInstancer ( const String name,
DecoratorInstancer instancer 
) [static]

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.

Decorator * Rocket::Core::Factory::InstanceDecorator ( const String name,
const PropertyDictionary properties 
) [static]

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.

FontEffectInstancer * Rocket::Core::Factory::RegisterFontEffectInstancer ( const String name,
FontEffectInstancer instancer 
) [static]

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.

FontEffect * Rocket::Core::Factory::InstanceFontEffect ( const String name,
const PropertyDictionary properties 
) [static]

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.

EventInstancer * Rocket::Core::Factory::RegisterEventInstancer ( EventInstancer instancer  )  [static]

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.

EventListenerInstancer * Rocket::Core::Factory::RegisterEventListenerInstancer ( EventListenerInstancer instancer  )  [static]

Register the instancer to be used for all event listeners.

Returns:
The registered instancer on success, NULL on failure.

EventListener * Rocket::Core::Factory::InstanceEventListener ( const String value  )  [static]

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