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

A list of objects containers, useful for accessing objects in a scoped way, along with methods to access them. More...

#include <ObjectsContainersList.h>

Public Types

enum  VariableExistence { DoesNotExist , Exists , GroupIsEmpty , ExistsOnlyOnSomeObjectsOfTheGroup }
 

Public Member Functions

bool HasObjectOrGroupNamed (const gd::String &name) const
 Check if the specified object or group exists.
 
VariableExistence HasObjectOrGroupWithVariableNamed (const gd::String &objectOrGroupName, const gd::String &variableName) const
 Check if the specified object or group has the specified variable in its declared variables.
 
bool HasObjectOrGroupVariablesContainer (const gd::String &objectOrGroupName, const gd::VariablesContainer &variablesContainer) const
 Check if the specified object or group has the specified variables container.
 
const gd::VariablesContainerGetObjectOrGroupVariablesContainer (const gd::String &objectOrGroupName) const
 Return the container of the variables for the specified object or group of objects.
 
gd::Variable::Type GetTypeOfObjectOrGroupVariable (const gd::String &objectOrGroupName, const gd::String &variableName) const
 Get a type from an object/group variable.
 
gd::String GetTypeOfObject (const gd::String &objectName) const
 Get a type from an object/group name. More...
 
bool HasBehaviorInObjectOrGroup (const gd::String &objectOrGroupName, const gd::String &behaviorName) const
 Check if an object or all object of a group has a behavior.
 
gd::String GetTypeOfBehaviorInObjectOrGroup (const gd::String &objectOrGroupName, const gd::String &behaviorName, bool searchInGroups=true) const
 Get the type of a behavior if an object or all objects of a group has it.
 
gd::String GetTypeOfBehavior (const gd::String &behaviorName, bool searchInGroups=true) const
 Get a type from a behavior name. More...
 
std::vector< gd::StringGetBehaviorsOfObject (const gd::String &objectName, bool searchInGroups=true) const
 Get behaviors of an object/group. More...
 
std::vector< gd::StringExpandObjectName (const gd::String &objectOrGroupName, const gd::String &onlyObjectToSelectIfPresent="") const
 Return a list containing all objects refered to by the group. If an object name is passed, then only this object name is returned. More...
 
void ForEachObject (std::function< void(const gd::Object &object)> fn) const
 
void ForEachNameMatchingSearch (const gd::String &search, std::function< void(const gd::String &name, const gd::ObjectConfiguration *objectConfiguration)> fn) const
 Call the callback for each object or group name matching the search passed in parameter.
 
void ForEachObjectOrGroupVariableMatchingSearch (const gd::String &objectOrGroupName, const gd::String &search, std::function< void(const gd::String &variableName, const gd::Variable &variable)> fn) const
 Call the callback for each variable of the object (or group) matching the search passed in parameter.
 
 ObjectsContainersList ()
 

Static Public Member Functions

static ObjectsContainersList MakeNewObjectsContainersListForProjectAndLayout (const gd::Project &project, const gd::Layout &layout)
 
static ObjectsContainersList MakeNewObjectsContainersListForContainers (const gd::ObjectsContainer &globalObjectsContainer, const gd::ObjectsContainer &objectsContainer)
 

Detailed Description

A list of objects containers, useful for accessing objects in a scoped way, along with methods to access them.

See also
gd::Object
gd::ObjectsContainer
gd::Project
gd::Layout

Constructor & Destructor Documentation

◆ ObjectsContainersList()

gd::ObjectsContainersList::ObjectsContainersList ( )
inline

Do not use - should be private but accessible to let Emscripten create a temporary.

Member Function Documentation

◆ ExpandObjectName()

std::vector< gd::String > gd::ObjectsContainersList::ExpandObjectName ( const gd::String objectOrGroupName,
const gd::String onlyObjectToSelectIfPresent = "" 
) const

Return a list containing all objects refered to by the group. If an object name is passed, then only this object name is returned.

If onlyObjectToSelectIfPresent is set and present in the group(s), only this object will be returned. This is useful for considering this object as the "currently selected" object, when generating a condition or an action.

◆ GetBehaviorsOfObject()

std::vector< gd::String > gd::ObjectsContainersList::GetBehaviorsOfObject ( const gd::String objectName,
bool  searchInGroups = true 
) const

Get behaviors of an object/group.

Note
The behaviors of a group are the behaviors which are found in common when looking all the objects of the group.
Returns
Vector containing names of behaviors

◆ GetTypeOfBehavior()

gd::String gd::ObjectsContainersList::GetTypeOfBehavior ( const gd::String behaviorName,
bool  searchInGroups = true 
) const

Get a type from a behavior name.

Returns
Type of the behavior.
Deprecated:
  • Use GetTypeOfBehaviorInObjectOrGroup instead.

◆ GetTypeOfObject()

gd::String gd::ObjectsContainersList::GetTypeOfObject ( const gd::String objectName) const

Get a type from an object/group name.

Note
If a group contains only objects of a same type, then the group has this type. Otherwise, it is considered as an object without any specific type.
Returns
Type of the object/group.

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