GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Class representing a folder structure in order to organize objects in folders (to be used with an ObjectsContainer.) More...
#include <ObjectFolderOrObject.h>
Public Member Functions | |
ObjectFolderOrObject () | |
Default constructor creating an empty instance. Useful for the null object pattern. | |
ObjectFolderOrObject (gd::String folderName_, ObjectFolderOrObject *parent_=nullptr) | |
Constructor for creating an instance representing a folder. | |
ObjectFolderOrObject (gd::Object *object_, ObjectFolderOrObject *parent_=nullptr) | |
Constructor for creating an instance representing an object. | |
gd::Object & | GetObject () const |
Returns the object 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 | HasObjectNamed (const gd::String &name) |
Returns true if the instance represents the object with the given name or if any of the children does (recursive search). | |
ObjectFolderOrObject & | GetObjectNamed (const gd::String &name) |
Returns the child instance holding the object with the given name (recursive search). | |
std::size_t | GetChildrenCount () const |
Returns the number of children. Returns 0 if the instance represents an object. | |
ObjectFolderOrObject & | GetChildAt (std::size_t index) |
Returns the child ObjectFolderOrObject at the given index. | |
const ObjectFolderOrObject & | GetChildAt (std::size_t index) const |
Returns the child ObjectFolderOrObject at the given index. | |
ObjectFolderOrObject & | GetObjectChild (const gd::String &name) |
Returns the child ObjectFolderOrObject that represents the object with the given name. To use only if sure that the instance holds the object in its direct children (no recursive search). More... | |
ObjectFolderOrObject & | GetParent () |
Returns the parent of the instance. If the instance has no parent (root folder), the null object 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 ObjectFolderOrObject &childToRemove) |
Removes the given child from the instance's children. If the given child contains children of its own, does nothing. | |
void | RemoveRecursivelyObjectNamed (const gd::String &name) |
Removes the child representing the object with the given name from the instance children and recursively does it for every folder children. | |
void | InsertObject (gd::Object *insertedObject, std::size_t position=(size_t) -1) |
Inserts an instance representing the given object at the given position. | |
ObjectFolderOrObject & | 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 ObjectFolderOrObject &otherObjectFolderOrObject) |
Returns true if the instance is a descendant of the given instance of ObjectFolderOrObject. | |
std::size_t | GetChildPosition (const ObjectFolderOrObject &child) const |
Returns the position of the given instance of ObjectFolderOrObject in the instance's children. | |
void | MoveObjectFolderOrObjectToAnotherFolder (gd::ObjectFolderOrObject &objectFolderOrObject, gd::ObjectFolderOrObject &newParentFolder, std::size_t newPosition) |
Moves the given child ObjectFolderOrObject to the given folder at the given position. | |
QuickCustomization::Visibility | GetQuickCustomizationVisibility () const |
void | SetQuickCustomizationVisibility (QuickCustomization::Visibility visibility) |
Saving and loading | |
Members functions related to saving and loading the objects of the class. | |
void | SerializeTo (SerializerElement &element) const |
Serialize the ObjectFolderOrObject instance. | |
void | UnserializeFrom (gd::Project &project, const SerializerElement &element, ObjectsContainer &objectsContainer) |
Unserialize the ObjectFolderOrObject instance. | |
Class representing a folder structure in order to organize objects in folders (to be used with an ObjectsContainer.)
ObjectFolderOrObject & gd::ObjectFolderOrObject::GetObjectChild | ( | const gd::String & | name | ) |
Returns the child ObjectFolderOrObject that represents the object with the given name. To use only if sure that the instance holds the object in its direct children (no recursive search).