libRocket
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Factory.h
Go to the documentation of this file.
1 /*
2  * This source file is part of libRocket, the HTML/CSS Interface Middleware
3  *
4  * For the latest information, see http://www.librocket.com
5  *
6  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  *
26  */
27 
28 #ifndef ROCKETCOREFACTORY_H
29 #define ROCKETCOREFACTORY_H
30 
31 #include "XMLParser.h"
32 #include "Header.h"
33 #include <map>
34 
35 namespace Rocket {
36 namespace Core {
37 
38 class Context;
39 class ContextInstancer;
40 class Decorator;
41 class DecoratorInstancer;
42 class Element;
43 class ElementDocument;
44 class ElementInstancer;
45 class Event;
46 class EventInstancer;
47 class EventListener;
48 class EventListenerInstancer;
49 class FontEffect;
50 class FontEffectInstancer;
51 class StyleSheet;
52 class PropertyDictionary;
53 
64 {
65 public:
67  static bool Initialise();
69  static void Shutdown();
70 
73  static ContextInstancer* RegisterContextInstancer(ContextInstancer* instancer);
77  static Context* InstanceContext(const String& name);
78 
83  static ElementInstancer* RegisterElementInstancer(const String& name, ElementInstancer* instancer);
87  static ElementInstancer* GetElementInstancer(const String& tag);
94  static Element* InstanceElement(Element* parent, const String& instancer, const String& tag, const XMLAttributes& attributes);
95 
101  static bool InstanceElementText(Element* parent, const String& text);
106  static bool InstanceElementStream(Element* parent, Stream* stream);
111  static ElementDocument* InstanceDocumentStream(Rocket::Core::Context* context, Stream* stream);
112 
117  static DecoratorInstancer* RegisterDecoratorInstancer(const String& name, DecoratorInstancer* instancer);
122  static Decorator* InstanceDecorator(const String& name, const PropertyDictionary& properties);
123 
128  static FontEffectInstancer* RegisterFontEffectInstancer(const String& name, FontEffectInstancer* instancer);
133  static FontEffect* InstanceFontEffect(const String& name, const PropertyDictionary& properties);
134 
138  static StyleSheet* InstanceStyleSheetString(const String& string);
142  static StyleSheet* InstanceStyleSheetFile(const String& file_name);
146  static StyleSheet* InstanceStyleSheetStream(Stream* stream);
148  static void ClearStyleSheetCache();
150  static void ClearTemplateCache();
151 
155  static EventInstancer* RegisterEventInstancer(EventInstancer* instancer);
162  static Event* InstanceEvent(Element* target, const String& name, const Dictionary& parameters, bool interruptible);
163 
166  static EventListenerInstancer* RegisterEventListenerInstancer(EventListenerInstancer* instancer);
171  static EventListener* InstanceEventListener(const String& value, Element* element);
172 
173 private:
174  Factory();
175  ~Factory();
176 };
177 
178 }
179 }
180 
181 #endif
#define ROCKETCORE_API
Definition: Header.h:73
Definition: ElementDocument.h:55
Definition: Event.h:48
Definition: DecoratorInstancer.h:50
Definition: Clipboard.h:33
Definition: StyleSheet.h:50
Definition: Context.h:62
Definition: EventListener.h:46
Definition: PropertyDictionary.h:45
Definition: FontEffectInstancer.h:50
Definition: EventListenerInstancer.h:48
Definition: Dictionary.h:44
Definition: FontEffect.h:42
Definition: EventInstancer.h:46
Definition: Stream.h:47
Definition: ElementInstancer.h:54
Definition: Decorator.h:53
Definition: Element.h:71
Definition: Factory.h:63
ROCKETCORE_API void Shutdown()
Shutdown Rocket.
ROCKETCORE_API bool Initialise()
Initialises Rocket.
Definition: ContextInstancer.h:46