AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
ElementFactory.hpp
1/*
2Copyright (C) 2019,2020,2023-2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGUI_ELEMENTFACTORY_H
17#define AEONGUI_ELEMENTFACTORY_H
18#include <memory>
19#include <functional>
20#include <string>
21#include "aeongui/Platform.hpp"
22#include "aeongui/StringLiteral.hpp"
23#include "aeongui/AttributeMap.hpp"
24
25namespace AeonGUI
26{
27 namespace DOM
28 {
29 class Node;
30 class Element;
31 }
38 DLL std::unique_ptr<DOM::Element> Construct ( const char* aIdentifier, AttributeMap&& aAttributeMap, DOM::Node* aParent );
43 DLL void Destroy ( const char* aIdentifier, DOM::Element* aElement );
50 DLL bool RegisterConstructor ( const StringLiteral& aIdentifier,
51 const std::function < std::unique_ptr<DOM::Element> ( AttributeMap&&, DOM::Node* ) > & aConstructor,
52 const std::function < void ( DOM::Element* ) > & aDestructor );
57 DLL bool UnregisterConstructor ( const StringLiteral& aIdentifier );
61 DLL void EnumerateConstructors ( const std::function<bool ( const StringLiteral& ) >& aEnumerator );
63 DLL void Initialize();
65 DLL void Finalize();
71 DLL bool AddInitializer (
72 const std::function < void ( DOM::Element* ) > & aInitializer,
73 const std::function < void ( DOM::Element* ) > & aFinalizer );
79 DLL bool RemoveInitializer (
80 const std::function < void ( DOM::Element* ) > & aInitializer,
81 const std::function < void ( DOM::Element* ) > & aFinalizer );
82}
83#endif
Platform-specific DLL import/export macros and compiler helpers.
Base class for DOM elements.
Definition Element.hpp:46
Base class for all nodes in the DOM tree.
Definition Node.hpp:40
Compile-time string literal wrapper.
Definition StringLiteral.hpp:32