The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
variable_info< V > Class Template Reference

Information on a WML variable. More...

#include <variable_info.hpp>

Inheritance diagram for variable_info< V >:

Public Member Functions

 variable_info (const std::string &varname, maybe_const_t< config, V > &vars) noexcept
 
std::string get_error_message () const
 
bool explicit_index () const
 
bool exists_as_attribute () const
 
bool exists_as_container () const
 
maybe_const_t< config::attribute_value, V > & as_scalar () const
 If instantiated with vi_policy_const, the lifetime of the returned const attribute_value reference might end with the lifetime of this object. More...
 
maybe_const_t< config, V > & as_container () const
 If instantiated with vi_policy_const, the lifetime of the returned const attribute_value reference might end with the lifetime of this object. More...
 
maybe_const_t< config::child_itors, V > as_array () const
 If instantiated with vi_policy_const, the lifetime of the returned const attribute_value reference might end with the lifetime of this object. More...
 

Protected Member Functions

void throw_on_invalid () const
 
void calculate_value ()
 

Protected Attributes

std::string name_
 
variable_info_implementation::variable_info_state< V > state_
 
bool valid_
 

Detailed Description

template<typename V>
class variable_info< V >

Information on a WML variable.

Definition at line 41 of file variable_info.hpp.

Constructor & Destructor Documentation

◆ variable_info()

template<typename V >
variable_info< V >::variable_info ( const std::string &  varname,
maybe_const_t< config, V > &  vars 
)
noexcept

Definition at line 66 of file variable_info.cpp.

Member Function Documentation

◆ as_array()

template<typename V >
maybe_const_t< config::child_itors, V > variable_info< V >::as_array

If instantiated with vi_policy_const, the lifetime of the returned const attribute_value reference might end with the lifetime of this object.

Range may be empty

Exceptions
invalid_variablename_exception

Definition at line 145 of file variable_info.cpp.

Referenced by terrain_filter::match_internal(), vconfig::all_children_iterator::operator++(), and game_events::WML_HANDLER_FUNCTION().

◆ as_container()

template<typename V >
maybe_const_t< config, V > & variable_info< V >::as_container

If instantiated with vi_policy_const, the lifetime of the returned const attribute_value reference might end with the lifetime of this object.

Exceptions
invalid_variablename_exception

Definition at line 138 of file variable_info.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), game_data::get_variable_cfg(), luaW_checkvariable(), luaW_pushvariable(), game_events::filter_dynamic::operator()(), and game_events::WML_HANDLER_FUNCTION().

◆ as_scalar()

template<typename V >
maybe_const_t< config::attribute_value, V > & variable_info< V >::as_scalar

If instantiated with vi_policy_const, the lifetime of the returned const attribute_value reference might end with the lifetime of this object.

Exceptions
invalid_variablename_exception

Definition at line 131 of file variable_info.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), game_data::get_variable(), config_variable_set::get_variable_const(), game_data::get_variable_const(), luaW_checkvariable(), luaW_pushvariable(), and game_events::WML_HANDLER_FUNCTION().

◆ calculate_value()

template<typename V >
void variable_info< V >::calculate_value
protected

Definition at line 79 of file variable_info.cpp.

References variable_info_implementation::parse_index().

◆ exists_as_attribute()

template<typename V >
bool variable_info< V >::exists_as_attribute

◆ exists_as_container()

template<typename V >
bool variable_info< V >::exists_as_container

◆ explicit_index()

template<typename V >
bool variable_info< V >::explicit_index

◆ get_error_message()

template<typename V >
std::string variable_info< V >::get_error_message

Definition at line 160 of file variable_info.cpp.

Referenced by luaW_checkvariable(), and luaW_pushvariable().

◆ throw_on_invalid()

template<typename V >
void variable_info< V >::throw_on_invalid
protected

Definition at line 152 of file variable_info.cpp.

Member Data Documentation

◆ name_

template<typename V >
std::string variable_info< V >::name_
protected

Definition at line 82 of file variable_info.hpp.

◆ state_

template<typename V >
variable_info_implementation::variable_info_state<V> variable_info< V >::state_
protected

Definition at line 83 of file variable_info.hpp.

◆ valid_

template<typename V >
bool variable_info< V >::valid_
protected

Definition at line 84 of file variable_info.hpp.


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