![]() |
GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Class representing a folder structure in order to organize functions in folders (to be used with a EventsFunctionsContainer.) More...
#include <FunctionFolderOrFunction.h>
Public Member Functions | |
| FunctionFolderOrFunction () | |
| Default constructor creating an empty instance. Useful for the null function pattern. | |
| FunctionFolderOrFunction (gd::String folderName_, FunctionFolderOrFunction *parent_=nullptr) | |
| Constructor for creating an instance representing a folder. | |
| FunctionFolderOrFunction (gd::EventsFunction *function_, FunctionFolderOrFunction *parent_=nullptr) | |
| Constructor for creating an instance representing a function. | |
| gd::EventsFunction & | GetFunction () const |
| Returns the function behind the instance. | |
| bool | IsFolder () const |
| Returns true if the instance represents a folder. | |
| const gd::String & | GetFolderName () const |
| Returns the name of the folder. | |
| void | SetFolderName (const gd::String &name) |
| Set the folder name. Does nothing if called on an instance not representing a folder. | |
| bool | HasFunctionNamed (const gd::String &name) |
| Returns true if the instance represents the function with the given name or if any of the children does (recursive search). | |
| FunctionFolderOrFunction & | GetFunctionNamed (const gd::String &name) |
| Returns the child instance holding the function with the given name (recursive search). | |
| std::size_t | GetChildrenCount () const |
| Returns the number of children. Returns 0 if the instance represents a function. | |
| FunctionFolderOrFunction & | GetChildAt (std::size_t index) |
| Returns the child FunctionFolderOrFunction at the given index. | |
| const FunctionFolderOrFunction & | GetChildAt (std::size_t index) const |
| Returns the child FunctionFolderOrFunction at the given index. | |
| FunctionFolderOrFunction & | GetFunctionChild (const gd::String &name) |
| Returns the child FunctionFolderOrFunction that represents the function with the given name. To use only if sure that the instance holds the function in its direct children (no recursive search). | |
| FunctionFolderOrFunction & | GetOrCreateChildFolder (const gd::String &name) |
| Returns the first direct child that represents a folder with the given name or create one. | |
| FunctionFolderOrFunction & | GetParent () |
| Returns the parent of the instance. If the instance has no parent (root folder), the null function is returned. | |
| bool | IsRootFolder () |
| Returns true if the instance is a root folder (that's to say it has no parent). | |
| void | MoveChild (std::size_t oldIndex, std::size_t newIndex) |
| Moves a child from a position to a new one. | |
| void | RemoveFolderChild (const FunctionFolderOrFunction &childToRemove) |
| Removes the given child from the instance's children. If the given child contains children of its own, does nothing. | |
| void | RemoveRecursivelyFunctionNamed (const gd::String &name) |
| Removes the child representing the function with the given name from the instance children and recursively does it for every folder children. | |
| void | Clear () |
| Clears all children. | |
| void | InsertFunction (gd::EventsFunction *insertedFunction, std::size_t position=(size_t) -1) |
| Inserts an instance representing the given function at the given position. | |
| FunctionFolderOrFunction & | InsertNewFolder (const gd::String &newFolderName, std::size_t position) |
| Inserts an instance representing a folder with the given name at the given position. | |
| bool | IsADescendantOf (const FunctionFolderOrFunction &otherFunctionFolderOrFunction) |
| Returns true if the instance is a descendant of the given instance of FunctionFolderOrFunction. | |
| std::size_t | GetChildPosition (const FunctionFolderOrFunction &child) const |
| Returns the position of the given instance of FunctionFolderOrFunction in the instance's children. | |
| void | MoveFunctionFolderOrFunctionToAnotherFolder (gd::FunctionFolderOrFunction &functionFolderOrFunction, gd::FunctionFolderOrFunction &newParentFolder, std::size_t newPosition) |
| Moves the given child FunctionFolderOrFunction to the given folder at the given position. | |
| void | UpdateGroupNameOfAllFunctions () |
Saving and loading | |
Members functions related to saving and loading the functions of the class. | |
| void | SerializeTo (SerializerElement &element) const |
| Serialize the FunctionFolderOrFunction instance. | |
| void | UnserializeFrom (const SerializerElement &element, EventsFunctionsContainer &functionsContainer) |
| Unserialize the FunctionFolderOrFunction instance. | |
Class representing a folder structure in order to organize functions in folders (to be used with a EventsFunctionsContainer.)