The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
wfl::formula_callable Class Referenceabstract

#include <callable.hpp>

Inheritance diagram for wfl::formula_callable:

Public Member Functions

 formula_callable (bool has_self=true)
 
virtual ~formula_callable ()
 
formula_callable_ptr fake_ptr ()
 
const_formula_callable_ptr fake_ptr () const
 
variant query_value (const std::string &key) const
 
void mutate_value (const std::string &key, const variant &value)
 
formula_input_vector inputs () const
 
virtual void get_inputs (formula_input_vector &) const
 
bool equals (const formula_callable &other) const
 
bool less (const formula_callable &other) const
 
bool has_key (const std::string &key) const
 
void serialize (std::string &str) const
 
void subscribe_dtor (callable_die_subscriber *d) const
 
void unsubscribe_dtor (callable_die_subscriber *d) const
 

Protected Types

enum  TYPE {
  FORMULA_C , TERRAIN_C , LOCATION_C , UNIT_TYPE_C ,
  UNIT_C , ATTACK_TYPE_C , MOVE_PARTIAL_C , MOVE_C ,
  ATTACK_C , MOVE_MAP_C
}
 

Protected Member Functions

virtual void set_value (const std::string &key, const variant &)
 
virtual int do_compare (const formula_callable *callable) const
 
virtual void serialize_to_string (std::string &) const
 

Static Protected Member Functions

template<typename T , typename K >
static variant convert_map (const std::map< T, K > &input_map)
 
template<typename T >
static variant convert_set (const std::set< T > &input_set)
 
template<typename T >
static variant convert_vector (const std::vector< T > &input_vector)
 
static void add_input (formula_input_vector &inputs, const std::string &key, formula_access access_type=formula_access::read_only)
 

Protected Attributes

TYPE type_
 
std::set< callable_die_subscriber * > dtor_notify
 

Private Member Functions

virtual variant get_value (const std::string &key) const =0
 

Private Attributes

bool has_self_
 

Detailed Description

Definition at line 29 of file callable.hpp.

Member Enumeration Documentation

◆ TYPE

Enumerator
FORMULA_C 
TERRAIN_C 
LOCATION_C 
UNIT_TYPE_C 
UNIT_C 
ATTACK_TYPE_C 
MOVE_PARTIAL_C 
MOVE_C 
ATTACK_C 
MOVE_MAP_C 

Definition at line 169 of file callable.hpp.

Constructor & Destructor Documentation

◆ formula_callable()

wfl::formula_callable::formula_callable ( bool  has_self = true)
inlineexplicit

Definition at line 32 of file callable.hpp.

◆ ~formula_callable()

virtual wfl::formula_callable::~formula_callable ( )
inlinevirtual

Definition at line 34 of file callable.hpp.

References d, and dtor_notify.

Member Function Documentation

◆ add_input()

static void wfl::formula_callable::add_input ( formula_input_vector inputs,
const std::string &  key,
formula_access  access_type = formula_access::read_only 
)
inlinestaticprotected

◆ convert_map()

template<typename T , typename K >
static variant wfl::formula_callable::convert_map ( const std::map< T, K > &  input_map)
inlinestaticprotected

Definition at line 104 of file callable.hpp.

References p.

◆ convert_set()

template<typename T >
static variant wfl::formula_callable::convert_set ( const std::set< T > &  input_set)
inlinestaticprotected

Definition at line 115 of file callable.hpp.

Referenced by wfl::unit_callable::get_value().

◆ convert_vector()

template<typename T >
static variant wfl::formula_callable::convert_vector ( const std::vector< T > &  input_vector)
inlinestaticprotected

◆ do_compare()

virtual int wfl::formula_callable::do_compare ( const formula_callable callable) const
inlineprotectedvirtual

◆ equals()

bool wfl::formula_callable::equals ( const formula_callable other) const
inline

Definition at line 72 of file callable.hpp.

References do_compare().

◆ fake_ptr() [1/2]

formula_callable_ptr wfl::formula_callable::fake_ptr ( )
inline

◆ fake_ptr() [2/2]

const_formula_callable_ptr wfl::formula_callable::fake_ptr ( ) const
inline

Definition at line 46 of file callable.hpp.

◆ get_inputs()

virtual void wfl::formula_callable::get_inputs ( formula_input_vector ) const
inlinevirtual

◆ get_value()

virtual variant wfl::formula_callable::get_value ( const std::string &  key) const
privatepure virtual

◆ has_key()

bool wfl::formula_callable::has_key ( const std::string &  key) const
inline

Definition at line 82 of file callable.hpp.

References wfl::variant::is_null(), and query_value().

Referenced by gui2::image_shape::draw(), and gui2::text_shape::draw().

◆ inputs()

formula_input_vector wfl::formula_callable::inputs ( ) const
inline

◆ less()

bool wfl::formula_callable::less ( const formula_callable other) const
inline

Definition at line 77 of file callable.hpp.

References do_compare().

◆ mutate_value()

void wfl::formula_callable::mutate_value ( const std::string &  key,
const variant value 
)
inline

Definition at line 58 of file callable.hpp.

References set_value().

Referenced by ai::formula_ai::set_value().

◆ query_value()

variant wfl::formula_callable::query_value ( const std::string &  key) const
inline

◆ serialize()

void wfl::formula_callable::serialize ( std::string &  str) const
inline

Definition at line 89 of file callable.hpp.

References serialize_to_string().

◆ serialize_to_string()

virtual void wfl::formula_callable::serialize_to_string ( std::string &  ) const
inlineprotectedvirtual

Reimplemented in wfl::key_value_pair, and wfl::location_callable.

Definition at line 161 of file callable.hpp.

Referenced by serialize().

◆ set_value()

virtual void wfl::formula_callable::set_value ( const std::string &  key,
const variant  
)
inlineprotectedvirtual

Reimplemented in ai::formula_ai, and wfl::map_formula_callable.

Definition at line 141 of file callable.hpp.

References PLAIN_LOG.

Referenced by mutate_value().

◆ subscribe_dtor()

void wfl::formula_callable::subscribe_dtor ( callable_die_subscriber d) const
inline

Definition at line 94 of file callable.hpp.

References d, and dtor_notify.

◆ unsubscribe_dtor()

void wfl::formula_callable::unsubscribe_dtor ( callable_die_subscriber d) const
inline

Definition at line 98 of file callable.hpp.

References d, and dtor_notify.

Member Data Documentation

◆ dtor_notify

std::set<callable_die_subscriber*> wfl::formula_callable::dtor_notify
mutableprotected

Definition at line 176 of file callable.hpp.

Referenced by subscribe_dtor(), unsubscribe_dtor(), and ~formula_callable().

◆ has_self_

bool wfl::formula_callable::has_self_
private

Definition at line 180 of file callable.hpp.

Referenced by query_value().

◆ type_

TYPE wfl::formula_callable::type_
protected

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