Game Develop Core: gd::VariablesContainer Class Reference

| Game Develop Core Core library for developing platforms and tools compatible with Game Develop.

- Main Page
- Modules
- Classes

- Class List
- Class Index
- Class Hierarchy

All Classes Files Functions Variables Typedefs Enumerations Macros Groups Pages
List of all members
gd::VariablesContainer Class Reference
Platform Definition ( Classes defining the common concepts used by all platforms )

Class defining a container for gd::Variable. More...

`#include <VariablesContainer.h>`

## Public Member Functions

Variables management
Members functions related to variables management.
bool | Has (const std::string &name) const
| Return true if the specified variable is in the container.
Variable & | Get (const std::string &name)
| Return a reference to the variable called name.
const Variable & | Get (const std::string &name) const
| Return a reference to the variable called name.
std::pair< std::string, gd::Variable > & | Get (unsigned int index)
| Return a pair containing the name and the variable at position in the container. More...
const std::pair< std::string, gd::Variable > & | Get (unsigned int index) const
| Return a pair containing the name and the variable at position in the container. More...
Variable & | Insert (const std::string &name, const Variable &variable, unsigned int position)
unsigned int | Count () const
| Return the number of variables.
unsigned int | GetPosition (const std::string &name) const
| return the position of the variable called "name" in the variable list
Variable & | InsertNew (const std::string &name, unsigned int position)
| Add a new empty variable at the specified position in the container. More...
void | Remove (const std::string &name)
| Remove the specified variable from the container.
void | Rename (const std::string &oldName, const std::string &newName)
| Rename a variable.
void | Swap (unsigned int firstVariableIndex, unsigned int secondVariableIndex)
| Swap the position of the specified variables.
void | Clear ()
| Clear all variables of the container.
Saving and loading
Members functions related to saving and loading the object.
virtual void | SaveToXml (TiXmlElement *element) const
virtual void | LoadFromXml (const TiXmlElement *element)

## Detailed Description

Class defining a container for gd::Variable.

See Also
  gd::Variable
  gd::Project
  gd::Layout
  gd::Object

## Member Function Documentation

std::pair< std::string, gd::Variable > & gd::VariablesContainer::Get | ( | unsigned int | index) |  |

Return a pair containing the name and the variable at position in the container.

Note
  If index is invalid, an empty variable is returned.

const std::pair< std::string, gd::Variable > & gd::VariablesContainer::Get | ( | unsigned int | index) |  | const

Return a pair containing the name and the variable at position in the container.

Note
  If index is invalid, an empty variable is returned.

Variable & gd::VariablesContainer::Insert | ( | const std::string & | name,
|  | const Variable & | variable,
|  | unsigned int | position
| ) |  |

Must add a new variable constructed from the variable passed as parameter.

Note
  No pointer or reference must be kept on the variable passed as parameter.

Parameters

  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.

Returns
  Reference to the newly added variable

Variable & gd::VariablesContainer::InsertNew | ( | const std::string & | name,
|  | unsigned int | position
| ) |  |

Add a new empty variable at the specified position in the container.

Parameters

  name | The new variable name
  position | Insertion position. If the position is invalid, the variable is inserted at the end of the variable list.

Returns
  Reference to the newly added variable

void gd::VariablesContainer::LoadFromXml | ( | const TiXmlElement * | element) |  |

virtual

Called to load the layout from a TiXmlElement.

void gd::VariablesContainer::SaveToXml | ( | TiXmlElement * | element) |  | const

virtual

Called to save the layout to a TiXmlElement.

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

- VariablesContainer.h
- VariablesContainer.cpp