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

Used as a base class for classes that will own events-backed functions. More...

#include <EventsFunctionsContainer.h>

Inherits gd::SerializableWithNameList< gd::EventsFunction >.

Inherited by gd::EventsFunctionsExtension.

Public Types

enum  FunctionOwner { Extension , Object , Behavior }
 

Public Member Functions

 EventsFunctionsContainer (FunctionOwner source_)
 
FunctionOwner GetOwner () const
 Get the source of the function container. More...
 
Events Functions management
bool HasEventsFunctionNamed (const gd::String &name) const
 Check if the function with the specified name exists.
 
gd::EventsFunctionGetEventsFunction (const gd::String &name)
 Get the function with the specified name. More...
 
const gd::EventsFunctionGetEventsFunction (const gd::String &name) const
 Get the function with the specified name. More...
 
gd::EventsFunctionGetEventsFunction (std::size_t index)
 Get the function at the specified index in the list. More...
 
const gd::EventsFunctionGetEventsFunction (std::size_t index) const
 Get the function at the specified index in the list. More...
 
std::size_t GetEventsFunctionsCount () const
 Return the number of functions.
 
gd::EventsFunctionInsertNewEventsFunction (const gd::String &name, std::size_t position)
 
gd::EventsFunctionInsertEventsFunction (const gd::EventsFunction &object, std::size_t position)
 
void RemoveEventsFunction (const gd::String &name)
 
void ClearEventsFunctions ()
 
void MoveEventsFunction (std::size_t oldIndex, std::size_t newIndex)
 
std::size_t GetEventsFunctionPosition (const gd::EventsFunction &eventsFunction)
 
const std::vector< std::unique_ptr< gd::EventsFunction > > & GetInternalVector () const
 Provide a raw access to the vector containing the functions.
 
std::vector< std::unique_ptr< gd::EventsFunction > > & GetInternalVector ()
 Provide a raw access to the vector containing the functions.
 
Serialization
void SerializeEventsFunctionsTo (SerializerElement &element) const
 Serialize events functions.
 
void UnserializeEventsFunctionsFrom (gd::Project &project, const SerializerElement &element)
 Unserialize the events functions.
 

Protected Member Functions

void Init (const gd::EventsFunctionsContainer &other)
 

Detailed Description

Used as a base class for classes that will own events-backed functions.

See also
gd::EventsFunctionContainer

Member Function Documentation

◆ GetEventsFunction() [1/4]

gd::EventsFunction& gd::EventsFunctionsContainer::GetEventsFunction ( const gd::String name)
inline

Get the function with the specified name.

Warning
Trying to access to a not existing function will result in undefined behavior.

◆ GetEventsFunction() [2/4]

const gd::EventsFunction& gd::EventsFunctionsContainer::GetEventsFunction ( const gd::String name) const
inline

Get the function with the specified name.

Warning
Trying to access to a not existing function will result in undefined behavior.

◆ GetEventsFunction() [3/4]

gd::EventsFunction& gd::EventsFunctionsContainer::GetEventsFunction ( std::size_t  index)
inline

Get the function at the specified index in the list.

Warning
Trying to access to a not existing function will result in undefined behavior.

◆ GetEventsFunction() [4/4]

const gd::EventsFunction& gd::EventsFunctionsContainer::GetEventsFunction ( std::size_t  index) const
inline

Get the function at the specified index in the list.

Warning
Trying to access to a not existing function will result in undefined behavior.

◆ GetOwner()

FunctionOwner gd::EventsFunctionsContainer::GetOwner ( ) const
inline

Get the source of the function container.

Note
For instance, it can be useful to handle specific parameters for behaviors.

◆ Init()

void gd::EventsFunctionsContainer::Init ( const gd::EventsFunctionsContainer other)
inlineprotected

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


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