The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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:
Inheritance graph

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_TYPE access_type=FORMULA_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 28 of file callable.hpp.

Member Enumeration Documentation

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 168 of file callable.hpp.

Constructor & Destructor Documentation

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

Definition at line 31 of file callable.hpp.

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

Definition at line 33 of file callable.hpp.

References d, and dtor_notify.

Member Function Documentation

static void wfl::formula_callable::add_input ( formula_input_vector inputs,
const std::string &  key,
FORMULA_ACCESS_TYPE  access_type = FORMULA_READ_ONLY 
)
inlinestaticprotected
template<typename T , typename K >
static variant wfl::formula_callable::convert_map ( const std::map< T, K > &  input_map)
inlinestaticprotected

Definition at line 103 of file callable.hpp.

References p.

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

Definition at line 114 of file callable.hpp.

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

template<typename T >
static variant wfl::formula_callable::convert_vector ( const std::vector< T > &  input_vector)
inlinestaticprotected
virtual int wfl::formula_callable::do_compare ( const formula_callable callable) const
inlineprotectedvirtual
bool wfl::formula_callable::equals ( const formula_callable other) const
inline

Definition at line 71 of file callable.hpp.

References do_compare().

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

Definition at line 45 of file callable.hpp.

virtual void wfl::formula_callable::get_inputs ( formula_input_vector ) const
inlinevirtual
virtual variant wfl::formula_callable::get_value ( const std::string &  key) const
privatepure virtual
bool wfl::formula_callable::has_key ( const std::string &  key) const
inline

Definition at line 81 of file callable.hpp.

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

Referenced by gui2::text_shape::draw().

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

Definition at line 62 of file callable.hpp.

References get_inputs().

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

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

Definition at line 76 of file callable.hpp.

References do_compare().

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

Definition at line 57 of file callable.hpp.

References set_value().

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

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

Definition at line 88 of file callable.hpp.

References 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 160 of file callable.hpp.

Referenced by serialize().

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

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

Definition at line 140 of file callable.hpp.

Referenced by mutate_value().

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

Definition at line 93 of file callable.hpp.

References dtor_notify.

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

Definition at line 97 of file callable.hpp.

References dtor_notify.

Member Data Documentation

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

Definition at line 175 of file callable.hpp.

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

bool wfl::formula_callable::has_self_
private

Definition at line 179 of file callable.hpp.

Referenced by query_value().

TYPE wfl::formula_callable::type_
protected

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