The Battle for Wesnoth  1.19.0+dev
Classes | Typedefs | Enumerations | Functions | Variables
variable_info_implementation Namespace Reference


class  vi_policy_const
 The variable_info policy classes. More...
class  vi_policy_create
 Creates a child table when resolving name if it doesn't exist yet. More...
class  vi_policy_throw
 Will throw an exception when trying to access a nonexistent table. More...
struct  maybe_const
struct  maybe_const< config::child_itors, const vi_policy_const >
struct  variable_info_state
class  info_visitor_base
 Visitor base class. More...
class  get_variable_key_visitor
 Adds a '. More...
class  get_variable_index_visitor
 Appends an [index] to the variable. More...
class  as_scalar_visitor
 Tries to convert it to an (maybe const) attribute value. More...
class  as_container_visitor
 Tries to convert to a [const] config&. More...
class  as_array_visitor
 This currently isn't implemented as a range-based operation because doing it on something like range 2-5 on vi_policy_const if child_ has only 4 elements would be too hard to implement. More...
class  as_range_visitor_base
class  clear_value_visitor
class  exists_as_container_visitor
class  replace_range_h
 Replaces the child in [startindex, endindex) with 'source' 'insert' and 'append' are subcases of this. More...
class  insert_range_h
class  append_range_h
class  merge_range_h


template<typename V , typename TResult >
using info_visitor = info_visitor_base< TResult, variable_info_state< V > >
template<typename V , typename TResult >
using info_visitor_const = info_visitor_base< TResult, const variable_info_state< V > >


enum  variable_info_state_type { state_start = 0 , state_named , state_indexed , state_temporary }


template<typename V , typename... T>
V::result_t apply_visitor (typename V::param_t state, T &&... args)
 Helper function to apply the result of a specified visitor to a variable_info object. More...
template<typename TConfig >
auto get_child_range (TConfig &cfg, const std::string &key, int start, int count) -> decltype(cfg.child_range(key))
void resolve_negative_value (int size, int &val)
int parse_index (const char *index_str)
 Parses a ']' terminated string. More...


const config non_empty_const_cfg ("_")

Typedef Documentation

◆ info_visitor

template<typename V , typename TResult >
using variable_info_implementation::info_visitor = typedef info_visitor_base<TResult, variable_info_state<V> >

Definition at line 115 of file variable_info_private.hpp.

◆ info_visitor_const

template<typename V , typename TResult >
using variable_info_implementation::info_visitor_const = typedef info_visitor_base<TResult, const variable_info_state<V> >

Definition at line 118 of file variable_info_private.hpp.

Enumeration Type Documentation

◆ variable_info_state_type


Represents the initial variable state before processing.


The result of .someval.

This can either mean an attribute value or a child range.


The result of .someval[index].

This is never an attribute value and is always a single config.


The result of .length.

This value can never be written, it can only be read.

Definition at line 119 of file variable_info_detail.hpp.

Function Documentation

◆ apply_visitor()

template<typename V , typename... T>
V::result_t variable_info_implementation::apply_visitor ( typename V::param_t  state,
T &&...  args 

Helper function to apply the result of a specified visitor to a variable_info object.

Template Parameters
VVisitor type.
TVisitor argument parameter pack.
stateInfo state (the actual variable data).
argsArguments to forward to visitor constructor.
Visitor output in its specified type.
std::range_errorIf state has an invalid type_ field.

Definition at line 37 of file variable_info.cpp.

References state_indexed, state_named, state_start, and state_temporary.

Referenced by spirit_po::default_plural_forms::evaluator::operator()().

◆ get_child_range()

template<typename TConfig >
auto variable_info_implementation::get_child_range ( TConfig &  cfg,
const std::string &  key,
int  start,
int  count 
) -> decltype(cfg.child_range(key))

◆ parse_index()

int variable_info_implementation::parse_index ( const char *  index_str)

Parses a ']' terminated string.

This is a important optimization of lexical_cast_default

Definition at line 57 of file variable_info_private.hpp.

References game_config::max_loop.

Referenced by variable_info< V >::calculate_value().

◆ resolve_negative_value()

void variable_info_implementation::resolve_negative_value ( int  size,
int &  val 

Variable Documentation

◆ non_empty_const_cfg

const config variable_info_implementation::non_empty_const_cfg("_") ( "_"  )