The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Typedefs | Enumerations | Functions | Variables
variable_info_implementation Namespace Reference

Classes

class  append_range_h
 
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_container_visitor
 Tries to convert to a [const] config&. More...
 
class  as_range_visitor_base
 
class  as_scalar_visitor
 Tries to convert it to an (maybe const) attribute value. More...
 
class  clear_value_visitor
 
class  exists_as_container_visitor
 
class  get_variable_index_visitor
 Appends an [index] to the variable. More...
 
class  get_variable_key_visitor
 Adds a '. More...
 
class  info_visitor_base
 Visitor base class. More...
 
class  insert_range_h
 
struct  maybe_const
 
struct  maybe_const< config::child_itors, const vi_policy_const >
 
class  merge_range_h
 
class  replace_range_h
 Replaces the child in [startindex, endindex) with 'source' 'insert' and 'append' are subcases of this. More...
 
struct  variable_info_state
 
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...
 

Typedefs

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 >>
 

Enumerations

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

Functions

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...
 

Variables

const config non_empty_const_cfg ("_")
 

Typedef Documentation

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.

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

Enumerator
state_start 

Represents the initial variable state before processing.

state_named 

The result of .someval.

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

state_indexed 

The result of .someval[index].

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

state_temporary 

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

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.
Parameters
stateInfo state (the actual variable data).
argsArguments to forward to visitor constructor.
Returns
Visitor output in its specified type.
Exceptions
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 config_attribute_value::apply_visitor(), stack_machine::compute(), impl_unit_get(), spirit_po::default_plural_forms::evaluator::operator()(), is_boolean::operator()(), emitter::operator()(), config_attribute_value::operator==(), unit::upkeep(), and unit::write_upkeep().

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))
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().

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

Variable Documentation

const config variable_info_implementation::non_empty_const_cfg("_")