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

A container for objects groups. More...

#include <ObjectGroupsContainer.h>

Public Member Functions

 ObjectGroupsContainer (const ObjectGroupsContainer &)
 
ObjectGroupsContaineroperator= (const ObjectGroupsContainer &rhs)
 
bool Has (const gd::String &name) const
 Return true if the specified group is in the container.
 
ObjectGroupGet (const gd::String &name)
 Return a reference to the group called name.
 
const ObjectGroupGet (const gd::String &name) const
 Return a reference to the group called name.
 
ObjectGroupGet (std::size_t index)
 Return the group at position \index in the container. More...
 
const ObjectGroupGet (std::size_t index) const
 Return the group at position \index in the container. More...
 
ObjectGroupInsert (const ObjectGroup &objectGroup, std::size_t position=-1)
 
std::size_t Count () const
 Return the number of groups.
 
bool IsEmpty () const
 Return true if the container is empty.
 
std::size_t GetPosition (const gd::String &name) const
 return the position of the group called "name" in the group list
 
ObjectGroupInsertNew (const gd::String &name, std::size_t position=-1)
 Add a new empty group at the specified position in the container. More...
 
void Remove (const gd::String &name)
 Remove the specified group from the container.
 
bool Rename (const gd::String &oldName, const gd::String &newName)
 Rename a group. More...
 
void Move (std::size_t oldIndex, std::size_t newIndex)
 Move the specified group at a new position in the list.
 
void Clear ()
 Clear all groups of the container.
 
void ForEachNameMatchingSearch (const gd::String &search, std::function< void(const gd::String &name)> fn) const
 Call the callback for each group name matching the specified search.
 
void Init (const gd::ObjectGroupsContainer &other)
 
Saving and loading

Members functions related to saving and loading the object.

void SerializeTo (SerializerElement &element) const
 Serialize objects groups container.
 
void UnserializeFrom (const SerializerElement &element)
 Unserialize the objects groups container.
 
std::vector API compatibility

These functions ensure that the class can be used just like a std::vector.

size_t size () const
 Alias for Count() More...
 
bool empty () const
 Alias for IsEmpty() More...
 
ObjectGroupoperator[] (size_t index)
 Alias for Get() More...
 
const ObjectGroupoperator[] (size_t index) const
 Alias for Get() More...
 
ObjectGroupat (size_t index)
 Alias for Get() More...
 
const ObjectGroupat (size_t index) const
 Alias for Get() More...
 

Detailed Description

A container for objects groups.

See also
gd::Project
gd::Layout

Member Function Documentation

◆ at() [1/2]

ObjectGroup& gd::ObjectGroupsContainer::at ( size_t  index)
inline

Alias for Get()

See also
ObjectGroupsContainer::Get.

◆ at() [2/2]

const ObjectGroup& gd::ObjectGroupsContainer::at ( size_t  index) const
inline

Alias for Get()

See also
ObjectGroupsContainer::Get.

◆ empty()

bool gd::ObjectGroupsContainer::empty ( ) const
inline

◆ Get() [1/2]

ObjectGroup & gd::ObjectGroupsContainer::Get ( std::size_t  index)

Return the group at position \index in the container.

Note
If index is invalid, an empty group is returned.

◆ Get() [2/2]

const ObjectGroup & gd::ObjectGroupsContainer::Get ( std::size_t  index) const

Return the group at position \index in the container.

Note
If index is invalid, an empty group is returned.

◆ Init()

void gd::ObjectGroupsContainer::Init ( const gd::ObjectGroupsContainer other)

Initialize from another object groups container. Used by copy-ctor and assign-op. Don't forget to update me if members were changed!

◆ Insert()

ObjectGroup & gd::ObjectGroupsContainer::Insert ( const ObjectGroup objectGroup,
std::size_t  position = -1 
)

Add a new group constructed from the group passed as parameter.

Parameters
objectGroupThe group that must be copied and inserted into the container
positionInsertion position. If the position is invalid, the group is inserted at the end of the group list.
Returns
Reference to the newly added group

◆ InsertNew()

ObjectGroup & gd::ObjectGroupsContainer::InsertNew ( const gd::String name,
std::size_t  position = -1 
)

Add a new empty group at the specified position in the container.

Parameters
nameThe new group name
positionInsertion position. If the position is invalid, the group is inserted at the end of the group list.
Returns
Reference to the newly added group

◆ operator[]() [1/2]

ObjectGroup& gd::ObjectGroupsContainer::operator[] ( size_t  index)
inline

Alias for Get()

See also
ObjectGroupsContainer::Get.

◆ operator[]() [2/2]

const ObjectGroup& gd::ObjectGroupsContainer::operator[] ( size_t  index) const
inline

Alias for Get()

See also
ObjectGroupsContainer::Get.

◆ Rename()

bool gd::ObjectGroupsContainer::Rename ( const gd::String oldName,
const gd::String newName 
)

Rename a group.

Returns
true if the group was renamed, false otherwise.

◆ size()

size_t gd::ObjectGroupsContainer::size ( ) const
inline

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