GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | List of all members
gd::PropertyFolderOrProperty Class Reference

Class representing a folder structure in order to organize properties in folders (to be used with a PropertiesContainer.) More...

#include <PropertyFolderOrProperty.h>

Public Member Functions

 PropertyFolderOrProperty ()
 Default constructor creating an empty instance. Useful for the null property pattern.
 
 PropertyFolderOrProperty (gd::String folderName_, PropertyFolderOrProperty *parent_=nullptr)
 Constructor for creating an instance representing a folder.
 
 PropertyFolderOrProperty (gd::NamedPropertyDescriptor *property_, PropertyFolderOrProperty *parent_=nullptr)
 Constructor for creating an instance representing a property.
 
gd::NamedPropertyDescriptorGetProperty () const
 Returns the property behind the instance.
 
bool IsFolder () const
 Returns true if the instance represents a folder.
 
const gd::StringGetFolderName () 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 HasPropertyNamed (const gd::String &name)
 Returns true if the instance represents the property with the given name or if any of the children does (recursive search).
 
PropertyFolderOrPropertyGetPropertyNamed (const gd::String &name)
 Returns the child instance holding the property with the given name (recursive search).
 
std::size_t GetChildrenCount () const
 Returns the number of children. Returns 0 if the instance represents a property.
 
PropertyFolderOrPropertyGetChildAt (std::size_t index)
 Returns the child PropertyFolderOrProperty at the given index.
 
const PropertyFolderOrPropertyGetChildAt (std::size_t index) const
 Returns the child PropertyFolderOrProperty at the given index.
 
PropertyFolderOrPropertyGetPropertyChild (const gd::String &name)
 Returns the child PropertyFolderOrProperty that represents the property with the given name. To use only if sure that the instance holds the property in its direct children (no recursive search).
 
PropertyFolderOrPropertyGetOrCreateChildFolder (const gd::String &name)
 Returns the first direct child that represents a folder with the given name or create one.
 
PropertyFolderOrPropertyGetParent ()
 Returns the parent of the instance. If the instance has no parent (root folder), the null property 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 PropertyFolderOrProperty &childToRemove)
 Removes the given child from the instance's children. If the given child contains children of its own, does nothing.
 
void RemoveRecursivelyPropertyNamed (const gd::String &name)
 Removes the child representing the property with the given name from the instance children and recursively does it for every folder children.
 
void Clear ()
 Clears all children.
 
void InsertProperty (gd::NamedPropertyDescriptor *insertedProperty, std::size_t position=(size_t) -1)
 Inserts an instance representing the given property at the given position.
 
PropertyFolderOrPropertyInsertNewFolder (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 PropertyFolderOrProperty &otherPropertyFolderOrProperty)
 Returns true if the instance is a descendant of the given instance of PropertyFolderOrProperty.
 
std::size_t GetChildPosition (const PropertyFolderOrProperty &child) const
 Returns the position of the given instance of PropertyFolderOrProperty in the instance's children.
 
void MovePropertyFolderOrPropertyToAnotherFolder (gd::PropertyFolderOrProperty &propertyFolderOrProperty, gd::PropertyFolderOrProperty &newParentFolder, std::size_t newPosition)
 Moves the given child PropertyFolderOrProperty to the given folder at the given position.
 
void UpdateGroupNameOfAllProperties ()
 
Saving and loading

Members functions related to saving and loading the properties of the class.

void SerializeTo (SerializerElement &element) const
 Serialize the PropertyFolderOrProperty instance.
 
void UnserializeFrom (gd::Project &project, const SerializerElement &element, PropertiesContainer &propertiesContainer)
 Unserialize the PropertyFolderOrProperty instance.
 

Detailed Description

Class representing a folder structure in order to organize properties in folders (to be used with a PropertiesContainer.)

See also
gd::PropertiesContainer

The documentation for this class was generated from the following files: