The Battle for Wesnoth  1.19.6+dev
Classes | Namespaces | Macros | Typedefs
function.hpp File Reference
#include "formula/callable.hpp"
#include "formula/formula.hpp"
#include <set>
#include <string>
Include dependency graph for function.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wfl::call_stack_manager
 Provides debugging information for error messages. More...
 
class  wfl::formula_expression
 
class  wfl::function_expression
 
class  wfl::key_value_pair
 
class  wfl::formula_function_expression
 
class  wfl::formula_function
 
class  wfl::user_formula_function
 
class  wfl::builtin_formula_function< T >
 
class  wfl::function_symbol_table
 
class  wfl::action_function_symbol_table
 
class  wfl::wrapper_formula
 

Namespaces

 wfl
 

Macros

#define DEFINE_WFL_FUNCTION(name, min_args, max_args)
 Helper macro to declare an associated class for a WFL function. More...
 
#define DECLARE_WFL_FUNCTION(name)    functions_table.add_function(#name, std::make_shared<builtin_formula_function<name##_function>>(#name))
 Declares a function name in the local function table functions_table. More...
 

Typedefs

typedef std::shared_ptr< function_expression > wfl::function_expression_ptr
 
typedef std::shared_ptr< formula_function > wfl::formula_function_ptr
 
typedef std::map< std::string, formula_function_ptr > wfl::functions_map
 

Macro Definition Documentation

◆ DECLARE_WFL_FUNCTION

#define DECLARE_WFL_FUNCTION (   name)     functions_table.add_function(#name, std::make_shared<builtin_formula_function<name##_function>>(#name))

Declares a function name in the local function table functions_table.

The function must be defined by a name_function class which is accessible in the current scope.

Definition at line 47 of file function.hpp.

◆ DEFINE_WFL_FUNCTION

#define DEFINE_WFL_FUNCTION (   name,
  min_args,
  max_args 
)
Value:
class name##_function : public function_expression \
{ \
public: \
explicit name##_function(const args_list& args) \
: function_expression(#name, args, min_args, max_args) \
{ \
} \
\
private: \
variant execute(const formula_callable& variables, formula_debugger* fdb) const; \
}; \
\
variant name##_function::execute( \
[[maybe_unused]] const formula_callable& variables, [[maybe_unused]] formula_debugger* fdb) const

Helper macro to declare an associated class for a WFL function.

Definition at line 27 of file function.hpp.