9 #include "GDCore/Project/EventsFunction.h"
10 #include "GDCore/Project/FunctionFolderOrFunction.h"
11 #include "GDCore/String.h"
12 #include "GDCore/Tools/SerializableWithNameList.h"
14 class SerializerElement;
37 rootFolder = gd::make_unique<gd::FunctionFolderOrFunction>(
"__ROOT");
41 : owner(other.owner) {
120 std::size_t position) {
121 auto &newlyCreatedFunction = InsertNew(name, position);
122 rootFolder->InsertFunction(&newlyCreatedFunction);
123 return newlyCreatedFunction;
128 std::size_t position) {
129 auto &newlyCreatedFunction = Insert(eventFunction, position);
130 rootFolder->InsertFunction(&newlyCreatedFunction);
131 return newlyCreatedFunction;
134 void RemoveEventsFunction(
const gd::String& name) {
135 rootFolder->RemoveRecursivelyFunctionNamed(name);
138 void ClearEventsFunctions() {
return Clear(); }
139 void MoveEventsFunction(std::size_t oldIndex, std::size_t newIndex) {
140 return Move(oldIndex, newIndex);
143 return GetPosition(eventsFunction);
174 std::size_t position);
181 std::vector<const FunctionFolderOrFunction *>
182 GetAllFunctionFolderOrFunction()
const;
186 void AddMissingFunctionsInRootFolder();
191 void SerializeFoldersTo(SerializerElement &element)
const;
196 void UnserializeFoldersFrom(
const SerializerElement &element);
206 return SerializeElementsTo(
"eventsFunction", element);
214 return UnserializeElementsFrom(
"eventsFunction", project, element);
225 rootFolder = gd::make_unique<gd::FunctionFolderOrFunction>(
"__ROOT");
231 std::unique_ptr<gd::FunctionFolderOrFunction> rootFolder;
Base class used to represents a behavior that can be applied to an object. It stores the content (i....
Definition: Behavior.h:24
Events that can be generated as a stand-alone function, and used as a condition, action or expression...
Definition: EventsFunction.h:38
Used as a base class for classes that will own events-backed functions.
Definition: EventsFunctionsContainer.h:27
FunctionOwner GetOwner() const
Get the source of the function container.
Definition: EventsFunctionsContainer.h:60
std::size_t GetEventsFunctionsCount() const
Return the number of functions.
Definition: EventsFunctionsContainer.h:117
gd::EventsFunction & GetEventsFunction(const gd::String &name)
Get the function with the specified name.
Definition: EventsFunctionsContainer.h:80
void SerializeEventsFunctionsTo(SerializerElement &element) const
Serialize events functions.
Definition: EventsFunctionsContainer.h:205
std::vector< std::unique_ptr< gd::EventsFunction > > & GetInternalVector()
Provide a raw access to the vector containing the functions.
Definition: EventsFunctionsContainer.h:157
gd::EventsFunction & GetEventsFunction(std::size_t index)
Get the function at the specified index in the list.
Definition: EventsFunctionsContainer.h:100
const std::vector< std::unique_ptr< gd::EventsFunction > > & GetInternalVector() const
Provide a raw access to the vector containing the functions.
Definition: EventsFunctionsContainer.h:149
const gd::EventsFunction & GetEventsFunction(std::size_t index) const
Get the function at the specified index in the list.
Definition: EventsFunctionsContainer.h:110
bool HasEventsFunctionNamed(const gd::String &name) const
Check if the function with the specified name exists.
Definition: EventsFunctionsContainer.h:70
void UnserializeEventsFunctionsFrom(gd::Project &project, const SerializerElement &element)
Unserialize the events functions.
Definition: EventsFunctionsContainer.h:212
const gd::EventsFunction & GetEventsFunction(const gd::String &name) const
Get the function with the specified name.
Definition: EventsFunctionsContainer.h:90
void Init(const gd::EventsFunctionsContainer &other)
Definition: EventsFunctionsContainer.h:222
Class representing a folder structure in order to organize functions in folders (to be used with a Ev...
Definition: FunctionFolderOrFunction.h:30
Represent an object of a platform.
Definition: Object.h:39
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:51
A class template that store a list of elements that can be accessed by their names and serialized.
Definition: SerializableWithNameList.h:33
void Init(const SerializableWithNameList< T > &other)
Definition: SerializableWithNameList.inl:190
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24