variable_info Struct Reference

Information on a WML variable. More...

#include <variable.hpp>

Collaboration diagram for variable_info:

Collaboration graph
[legend]

List of all members.

Public Types

enum  TYPE { TYPE_SCALAR, TYPE_ARRAY, TYPE_CONTAINER, TYPE_UNSPECIFIED }
 TYPE: the correct variable type should be decided by the user of the info structure Note: an Array can also be considered a Container, since index 0 will be used by default. More...
typedef std::pair< std::vector
< config * >::iterator,
std::vector< config * >
::iterator > 
array_range

Public Member Functions

 variable_info (const std::string &varname, bool force_valid=true, TYPE validation_type=TYPE_UNSPECIFIED)
t_stringas_scalar ()
 Results: after deciding the desired type, these methods can retrieve the result Note: first you should force_valid or check is_valid, otherwise these may fail.
configas_container ()
array_range as_array ()

Public Attributes

TYPE vartype
bool is_valid
std::string key
bool explicit_index
size_t index
configvars


Detailed Description

Information on a WML variable.

Definition at line 155 of file variable.hpp.


Member Typedef Documentation

typedef std::pair<std::vector<config*>::iterator, std::vector<config*>::iterator> variable_info::array_range

Definition at line 157 of file variable.hpp.


Member Enumeration Documentation

TYPE: the correct variable type should be decided by the user of the info structure Note: an Array can also be considered a Container, since index 0 will be used by default.

Enumerator:
TYPE_SCALAR 
TYPE_ARRAY 
TYPE_CONTAINER 
TYPE_UNSPECIFIED 

Definition at line 163 of file variable.hpp.


Constructor & Destructor Documentation

variable_info::variable_info ( const std::string &  varname,
bool  force_valid = true,
TYPE  validation_type = TYPE_UNSPECIFIED 
)


Member Function Documentation

t_string & variable_info::as_scalar (  ) 

Results: after deciding the desired type, these methods can retrieve the result Note: first you should force_valid or check is_valid, otherwise these may fail.

Definition at line 660 of file variable.cpp.

References is_valid, key, config::values, and vars.

Referenced by game_state::get_variable_const().

config & variable_info::as_container (  ) 

variable_info::array_range variable_info::as_array (  ) 


Member Data Documentation

Definition at line 171 of file variable.hpp.

Referenced by variable_info().

std::string variable_info::key


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

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs