![]() |
GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
A list of events. More...
#include <EventsList.h>
Public Member Functions | |
| EventsList (const EventsList &) | |
| EventsList & | operator= (const EventsList &rhs) |
| gd::BaseEvent & | InsertEvent (const gd::BaseEvent &event, size_t position=(size_t) -1) |
| Insert the specified event to the list. More... | |
| void | InsertEvent (std::shared_ptr< gd::BaseEvent > event, size_t position=(size_t) -1) |
| Insert the specified event to the list. More... | |
| gd::BaseEvent & | InsertNewEvent (gd::Project &project, const gd::String &eventType, size_t position=(size_t) -1) |
| Insert a new event to the list. More... | |
| void | InsertEvents (const EventsList &otherEvents, size_t begin, size_t end, size_t position=(size_t) -1) |
| Copy events from another list. | |
| size_t | GetEventsCount () const |
| Return the number of events. | |
| std::shared_ptr< BaseEvent > | GetEventSmartPtr (size_t index) |
| Return the smart pointer to the event at position index in the events list. | |
| std::shared_ptr< const BaseEvent > | GetEventSmartPtr (size_t index) const |
| Return the smart pointer to the event at position index in the events list. | |
| gd::BaseEvent & | GetEvent (size_t index) |
| Return a reference to the event at position index in the events list. | |
| const gd::BaseEvent & | GetEvent (size_t index) const |
| Return a reference to the event at position index in the events list. | |
| void | RemoveEvent (const gd::BaseEvent &event) |
| Remove the specified event. | |
| void | RemoveEvent (size_t index) |
| Remove the event at the specified index in the list. | |
| bool | IsEmpty () const |
| Return true if there isn't any event in the list. | |
| void | Clear () |
| Clear the list of events. | |
Utilities | |
Utility methods | |
| bool | Contains (const gd::BaseEvent &eventToSearch, bool recursive=true) const |
| bool | MoveEventToAnotherEventsList (const gd::BaseEvent &eventToMove, gd::EventsList &newEventsList, std::size_t newPosition) |
std::vector API compatibility | |
These functions ensure that the class can be used just like a std::vector. | |
| size_t | size () const |
| Alias for GetEventsCount() More... | |
| gd::BaseEvent & | operator[] (size_t index) |
| Alias for GetEvent() More... | |
| const gd::BaseEvent & | operator[] (size_t index) const |
| Alias for GetEvent() More... | |
Saving and loading | |
Members functions related to saving and loading the events list. | |
| void | SerializeTo (SerializerElement &element) const |
| Serialize the events to the specified element. More... | |
| void | UnserializeFrom (gd::Project &project, const SerializerElement &element) |
| Load the events from the specified element. More... | |
A list of events.
| bool gd::EventsList::Contains | ( | const gd::BaseEvent & | eventToSearch, |
| bool | recursive = true |
||
| ) | const |
Return true if the specified event exists in the list.
| event | The event to searched for |
| recursive | Set it to false to prevent sub events to be inspected. |
| gd::BaseEvent & gd::EventsList::InsertEvent | ( | const gd::BaseEvent & | event, |
| size_t | position = (size_t)-1 |
||
| ) |
Insert the specified event to the list.
| event | The event that must be copied and inserted into the list |
| position | Insertion position. If the position is invalid, the object is inserted at the end of the objects list. |
| void gd::EventsList::InsertEvent | ( | std::shared_ptr< gd::BaseEvent > | event, |
| size_t | position = (size_t)-1 |
||
| ) |
Insert the specified event to the list.
| event | The smart pointer to the event that must be inserted into the list |
| position | Insertion position. If the position is invalid, the object is inserted at the end of the objects list. |
| gd::BaseEvent & gd::EventsList::InsertNewEvent | ( | gd::Project & | project, |
| const gd::String & | eventType, | ||
| size_t | position = (size_t)-1 |
||
| ) |
Insert a new event to the list.
| project | The project the events list belongs to. |
| eventType | The type of the event |
| position | Insertion position. If the position is invalid, the object is inserted at the end of the objects list. |
| bool gd::EventsList::MoveEventToAnotherEventsList | ( | const gd::BaseEvent & | eventToMove, |
| gd::EventsList & | newEventsList, | ||
| std::size_t | newPosition | ||
| ) |
Move the specified event, that must be in the events list, to another events list without invalidating the event (i.e: without destroying/cloning it) in memory.
| eventToMove | The event to be moved |
| newEventsList | The new events list |
| newPosition | The position in the new events list |
|
inline |
Alias for GetEvent()
|
inline |
Alias for GetEvent()
| void gd::EventsList::SerializeTo | ( | SerializerElement & | element | ) | const |
Serialize the events to the specified element.
|
inline |
Alias for GetEventsCount()
| void gd::EventsList::UnserializeFrom | ( | gd::Project & | project, |
| const SerializerElement & | element | ||
| ) |
Load the events from the specified element.