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

Additional functionality for a non-const variable_info. More...

#include <variable_info.hpp>

Inheritance diagram for variable_info_mutable< V >:

Public Member Functions

 variable_info_mutable (const std::string &name, config &game_vars)
 
config::child_itors append_array (std::vector< config > children) const
 
config::child_itors insert_array (std::vector< config > children) const
 
config::child_itors replace_array (std::vector< config > children) const
 
void merge_array (std::vector< config > children) const
 
void clear (bool only_tables=false) const
 Clears the value this object points to. More...
 
- Public Member Functions inherited from variable_info< V >
 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...
 

Additional Inherited Members

- Protected Member Functions inherited from variable_info< V >
void throw_on_invalid () const
 
void calculate_value ()
 
- Protected Attributes inherited from variable_info< V >
std::string name_
 
variable_info_implementation::variable_info_state< V > state_
 
bool valid_
 

Detailed Description

template<typename V>
class variable_info_mutable< V >

Additional functionality for a non-const variable_info.

Todo:
: should these functions take a reference?

Definition at line 95 of file variable_info.hpp.

Constructor & Destructor Documentation

◆ variable_info_mutable()

template<typename V >
variable_info_mutable< V >::variable_info_mutable ( const std::string &  name,
config game_vars 
)
inline

Definition at line 98 of file variable_info.hpp.

Member Function Documentation

◆ append_array()

template<typename V >
config::child_itors variable_info_mutable< V >::append_array ( std::vector< config children) const
Returns
The new appended range.
Exceptions
invalid_variablename_exception

Definition at line 198 of file variable_info.cpp.

Referenced by game_data::add_variable_cfg(), and game_events::WML_HANDLER_FUNCTION().

◆ clear()

template<typename V >
void variable_info_mutable< V >::clear ( bool  only_tables = false) const

Clears the value this object points to.

Parameters
only_tablesIf true, will not clear attribute values.
Exceptions
invalid_variablename_exception

Definition at line 181 of file variable_info.cpp.

Referenced by game_data::clear_variable(), and game_data::clear_variable_cfg().

◆ insert_array()

template<typename V >
config::child_itors variable_info_mutable< V >::insert_array ( std::vector< config children) const
Returns
The new inserted range.
Exceptions
invalid_variablename_exception

Definition at line 205 of file variable_info.cpp.

Referenced by game_events::WML_HANDLER_FUNCTION().

◆ merge_array()

template<typename V >
void variable_info_mutable< V >::merge_array ( std::vector< config children) const
Exceptions
invalid_variablename_exception

Definition at line 219 of file variable_info.cpp.

Referenced by game_events::WML_HANDLER_FUNCTION().

◆ replace_array()

template<typename V >
config::child_itors variable_info_mutable< V >::replace_array ( std::vector< config children) const
Returns
The new range.
Exceptions
invalid_variablename_exception

Definition at line 212 of file variable_info.cpp.

Referenced by game_events::WML_HANDLER_FUNCTION().


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