![]() |
GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Class defining a container for gd::Variable. More...
#include <VariablesContainer.h>
Public Types | |
| enum | SourceType { Unknown , Global , Scene , Object , Local , ExtensionGlobal , ExtensionScene , Parameters , Properties } |
Public Member Functions | |
| VariablesContainer (const SourceType sourceType) | |
| VariablesContainer (const VariablesContainer &) | |
| VariablesContainer & | operator= (const VariablesContainer &rhs) |
| SourceType | GetSourceType () const |
Variables management | |
Members functions related to variables management. | |
| bool | Has (const gd::String &name) const |
| Return true if the specified variable is in the container. | |
| Variable & | Get (const gd::String &name) |
| Return a reference to the variable called name. | |
| const Variable & | Get (const gd::String &name) const |
| Return a reference to the variable called name. | |
| Variable & | Get (std::size_t index) |
| Return a reference to the variable at the specified position in the list. | |
| const Variable & | Get (std::size_t index) const |
| Return a reference to the variable at the specified position in the list. | |
| Variable & | Insert (const gd::String &name, const Variable &variable, std::size_t position) |
| std::size_t | Count () const |
| Return the number of variables. | |
| const gd::String & | GetNameAt (std::size_t index) const |
| Return the name of the variable at a position. | |
| std::size_t | GetPosition (const gd::String &name) const |
| return the position of the variable called "name" in the variable list | |
| Variable & | InsertNew (const gd::String &name, std::size_t position=-1) |
| Add a new empty variable at the specified position in the container. More... | |
| void | Remove (const gd::String &name) |
| Remove the variable with the specified name from the container. More... | |
| void | RemoveRecursively (const gd::Variable &variable) |
| Remove the specified variable from the container. | |
| bool | Rename (const gd::String &oldName, const gd::String &newName) |
| Rename a variable. More... | |
| void | Swap (std::size_t firstVariableIndex, std::size_t secondVariableIndex) |
| Swap the position of the specified variables. | |
| void | Move (std::size_t oldIndex, std::size_t newIndex) |
| Move the specified variable at a new position in the list. | |
| void | Clear () |
| Clear all variables of the container. | |
| void | ForEachVariableMatchingSearch (const gd::String &search, std::function< void(const gd::String &name, const gd::Variable &variable)> fn) const |
| Call the callback for each variable with a name matching the specified search. | |
Saving and loading | |
Members functions related to saving and loading the object. | |
| void | SerializeTo (SerializerElement &element) const |
| Serialize variable container. | |
| void | UnserializeFrom (const SerializerElement &element) |
| Unserialize the variable container. | |
| VariablesContainer & | ResetPersistentUuid () |
| Reset the persistent UUID, used to recognize the same variables between serialization. | |
| VariablesContainer & | ClearPersistentUuid () |
| Remove the persistent UUID - when the variables no longer need to be recognized between serializations. | |
| const gd::String & | GetPersistentUuid () const |
| Get the persistent UUID used to recognize the same variables between serialization. | |
Class defining a container for gd::Variable.
| Variable & gd::VariablesContainer::Insert | ( | const gd::String & | name, |
| const Variable & | variable, | ||
| std::size_t | position | ||
| ) |
Must add a new variable constructed from the variable passed as parameter.
| variable | The variable that must be copied and inserted into the container |
| position | Insertion position. If the position is invalid, the variable is inserted at the end of the variable list. |
| Variable & gd::VariablesContainer::InsertNew | ( | const gd::String & | name, |
| std::size_t | position = -1 |
||
| ) |
Add a new empty variable at the specified position in the container.
| name | The new variable name |
| position | Insertion position. If the position is invalid, the variable is inserted at the end of the variable list. |
| void gd::VariablesContainer::Remove | ( | const gd::String & | name | ) |
Remove the variable with the specified name from the container.
| bool gd::VariablesContainer::Rename | ( | const gd::String & | oldName, |
| const gd::String & | newName | ||
| ) |
Rename a variable.