GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | List of all members

Represent an behaviors container of a platform. More...

#include <BehaviorsContainer.h>

Public Member Functions

 BehaviorsContainer (bool isOverriding=false)
 
 BehaviorsContainer (const gd::BehaviorsContainer &behaviorsContainer)
 
BehaviorsContaineroperator= (const gd::BehaviorsContainer &behaviorsContainer)
 
virtual ~BehaviorsContainer ()
 
Behaviors management

Members functions related to behaviors management.

std::vector< gd::StringGetAllBehaviorNames () const
 Return a vector containing the names of all the behaviors used by the behaviors container.
 
BehaviorGetBehavior (const gd::String &name)
 Return a reference to the content of the behavior called name.
 
const BehaviorGetBehavior (const gd::String &name) const
 Return a reference to the content of the behavior called name.
 
bool HasBehaviorNamed (const gd::String &name) const
 Return true if behaviors container has a behavior called name.
 
void RemoveBehavior (const gd::String &name)
 Remove behavior called name.
 
bool RenameBehavior (const gd::String &name, const gd::String &newName)
 Change the name of behavior called name to newName. More...
 
gd::BehaviorAddNewBehavior (const gd::Project &project, const gd::String &type, const gd::String &name)
 Add the behavior of the specified type with the specified name. More...
 
const std::map< gd::String, std::unique_ptr< gd::Behavior > > & GetAllBehaviorContents () const
 Get a read-only access to the map containing the behaviors with their properties.
 

Serialization

Members functions related to serialization of the behaviors container

bool isOverriding = false
 
std::map< gd::String, std::unique_ptr< gd::Behavior > > behaviors
 
void SerializeTo (SerializerElement &element) const
 Serialize the behaviors container. More...
 
void UnserializeFrom (gd::Project &project, const SerializerElement &element)
 Unserialize the behaviors container. More...
 
void Init (const gd::BehaviorsContainer &behaviorsContainer)
 

Detailed Description

Represent an behaviors container of a platform.

Constructor & Destructor Documentation

◆ BehaviorsContainer() [1/2]

gd::BehaviorsContainer::BehaviorsContainer ( bool  isOverriding = false)

Create a new behaviors container with the name passed as argument.

◆ BehaviorsContainer() [2/2]

gd::BehaviorsContainer::BehaviorsContainer ( const gd::BehaviorsContainer behaviorsContainer)
inline

Copy constructor. Calls Init().

◆ ~BehaviorsContainer()

gd::BehaviorsContainer::~BehaviorsContainer ( )
virtual

Destructor.

Member Function Documentation

◆ AddNewBehavior()

gd::Behavior * gd::BehaviorsContainer::AddNewBehavior ( const gd::Project project,
const gd::String type,
const gd::String name 
)

Add the behavior of the specified type with the specified name.

The project's current platform is used to initialize the content.

Returns
A pointer to the newly added behavior content. NULL if the creation failed.

◆ Init()

void gd::BehaviorsContainer::Init ( const gd::BehaviorsContainer behaviorsContainer)
protected

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

It's needed because there is no default copy for a map of unique_ptr like behaviors and it must be a deep copy.

◆ operator=()

BehaviorsContainer& gd::BehaviorsContainer::operator= ( const gd::BehaviorsContainer behaviorsContainer)
inline

Assignment operator. Calls Init().

◆ RenameBehavior()

bool gd::BehaviorsContainer::RenameBehavior ( const gd::String name,
const gd::String newName 
)

Change the name of behavior called name to newName.

Returns
true if name was successfully changed

◆ SerializeTo()

void gd::BehaviorsContainer::SerializeTo ( SerializerElement element) const

Serialize the behaviors container.

See also
DoSerializeTo

◆ UnserializeFrom()

void gd::BehaviorsContainer::UnserializeFrom ( gd::Project project,
const SerializerElement element 
)

Unserialize the behaviors container.

See also
DoUnserializeFrom

Member Data Documentation

◆ behaviors

std::map<gd::String, std::unique_ptr<gd::Behavior> > gd::BehaviorsContainer::behaviors
protected

Contains all behaviors and their properties for the behaviors container. Behavior contents are the ownership of the behaviors container.


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