Game Develop Core: gd::Variable 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
Public Member Functions | List of all members
gd::Variable Class Reference
Platform Definition ( Classes defining the common concepts used by all platforms )

Defines a variable which can be used by an object, a layout or a project. More...

`#include <Variable.h>`

## Public Member Functions

| Variable ()
| Default constructor creating a variable with 0 as value.
Number or string
Methods and operators used when the variable is considered as a number or a string.
const std::string & | GetString () const
| Return the content of the variable, considered as a string.
virtual void | SetString (const std::string &newStr)
| Change the content of the variable, considered as a string.
double | GetValue () const
| Return the content of the variable, considered as a number. More...
virtual void | SetValue (double val)
| Change the content of the variable, considered as a number.
void | operator= (double val)
void | operator+= (double val)
void | operator-= (double val)
void | operator*= (double val)
void | operator/= (double val)
bool | operator<= (double val) const
bool | operator>= (double val) const
bool | operator< (double val) const
bool | operator> (double val) const
bool | operator== (double val) const
bool | operator!= (double val) const
void | operator= (const std::string &val)
void | operator+= (const std::string &val)
bool | operator== (const std::string &val) const
bool | operator!= (const std::string &val) const
bool | IsNumber () const
| Return true if the variable is a number.
Structure
Methods used when the variable is considered as a structure.
bool | IsStructure () const
| Return true if the variable is a structure which can have children.
virtual bool | HasChild (const std::string &name) const
| Return true if the variable is a structure and has the specified child.
virtual Variable & | GetChild (const std::string &name)
| Return the child with the specified name. More...
virtual const Variable & | GetChild (const std::string &name) const
| Return the child with the specified name. More...
void | RemoveChild (const std::string &name)
| Remove the child with the specified name. More...
const std::map< std::string, Variable > & | GetAllChildren () const
| Get the map containing all the children.
Serialization
Methods used when to load or save a variable to XML.
void | SaveToXml (TiXmlElement *element) const
void | LoadFromXml (const TiXmlElement *element)

## Detailed Description

Defines a variable which can be used by an object, a layout or a project.

See Also
  gd::VariablesContainer

## Member Function Documentation

Variable & gd::Variable::GetChild | ( | const std::string & | name) |  |

virtual

Return the child with the specified name.

If the variable has not the specified child, an empty variable with the specified name is added as child.

If the variable is not a structure or has not the specified child, an empty variable is returned.

const Variable & gd::Variable::GetChild | ( | const std::string & | name) |  | const

virtual

Return the child with the specified name.

If the variable has not the specified child, an empty variable with the specified name is added as child.

If the variable is not a structure or has not the specified child, an empty variable is returned.

double gd::Variable::GetValue | ( | ) |  | const

Return the content of the variable, considered as a number.

Get value as a double

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

Called to load the layout from a TiXmlElement.

void gd::Variable::RemoveChild | ( | const std::string & | name) |  |

Remove the child with the specified name.

If the variable is not a structure or has not the specified child, nothing is done.

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

Called to save the layout to a TiXmlElement.

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

- Variable.h
- Variable.cpp