The Battle for Wesnoth  1.19.7+dev
Classes | Namespaces | Macros | Typedefs
default_plural_forms_expressions.hpp File Reference
#include <algorithm>
#include <vector>
#include <boost/spirit/include/qi.hpp>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <boost/variant/variant.hpp>
#include <boost/variant/recursive_wrapper.hpp>
Include dependency graph for default_plural_forms_expressions.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  spirit_po::default_plural_forms::constant
 
struct  spirit_po::default_plural_forms::n_var
 
struct  spirit_po::default_plural_forms::not_op
 
struct  spirit_po::default_plural_forms::ternary_op
 
struct  spirit_po::default_plural_forms::evaluator
 

Namespaces

 spirit_po
 
 spirit_po::default_plural_forms
 

Macros

#define BOOST_SPIRIT_USE_PHOENIX_V3
 
#define FOREACH_SPIRIT_PO_BINARY_OP(X_)    X_(eq_op, ==) X_(neq_op, !=) X_(ge_op, >=) X_(le_op, <=) X_(gt_op, >) X_(lt_op, <) X_(mod_op, %)
 
#define FOREACH_SPIRIT_PO_CONJUNCTION(X_)    X_(and_op, &&) X_(or_op, ||)
 
#define FWD_DECL_(name, op)   struct name ; \
 
#define WRAP_(name, op)   boost::recursive_wrapper< name >, \
 
#define DECL_(name, op)   struct name { expr e1, e2; }; \
 
#define EVAL_OP_(name, OPERATOR)    uint operator()(const name & op) const { return (boost::apply_visitor(*this, op.e1)) OPERATOR (boost::apply_visitor(*this, op.e2)); } \
 
#define ADAPT_STRUCT_(name, op)
 
#define ENUMERATE(X, Y)   X,
 
#define EMIT_OP_(name, op)
 
#define MACHINE_ASSERT(...)   do {} while(0)
 
#define STACK_MACHINE_CASE_(name, op)
 

Typedefs

typedef boost::variant< constant, n_var, boost::recursive_wrapper< not_op >, boost::recursive_wrapper< ternary_op > > spirit_po::default_plural_forms::expr
 

Macro Definition Documentation

◆ ADAPT_STRUCT_

#define ADAPT_STRUCT_ (   name,
  op 
)
Value:
BOOST_FUSION_ADAPT_STRUCT(spirit_po::default_plural_forms:: name, \
boost::variant< constant, n_var, boost::recursive_wrapper< not_op >, boost::recursive_wrapper< ternary_op > > expr

◆ BOOST_SPIRIT_USE_PHOENIX_V3

#define BOOST_SPIRIT_USE_PHOENIX_V3

Definition at line 20 of file default_plural_forms_expressions.hpp.

◆ DECL_

#define DECL_ (   name,
  op 
)    struct name { expr e1, e2; }; \

Definition at line 91 of file default_plural_forms_expressions.hpp.

◆ EMIT_OP_

#define EMIT_OP_ (   name,
  op 
)
Value:
std::vector<instruction> operator()(const name & o) const { \
auto result = boost::apply_visitor(*this, o.e1); \
auto temp = boost::apply_visitor(*this, o.e2); \
std::move(temp.begin(), temp.end(), std::back_inserter(result)); \
result.emplace_back(op_code::name); \
return result; \
}
V::result_t apply_visitor(typename V::param_t state, T &&... args)
Helper function to apply the result of a specified visitor to a variable_info object.

◆ ENUMERATE

#define ENUMERATE (   X,
 
)    X,

◆ EVAL_OP_

#define EVAL_OP_ (   name,
  OPERATOR 
)     uint operator()(const name & op) const { return (boost::apply_visitor(*this, op.e1)) OPERATOR (boost::apply_visitor(*this, op.e2)); } \

Definition at line 110 of file default_plural_forms_expressions.hpp.

◆ FOREACH_SPIRIT_PO_BINARY_OP

#define FOREACH_SPIRIT_PO_BINARY_OP (   X_)     X_(eq_op, ==) X_(neq_op, !=) X_(ge_op, >=) X_(le_op, <=) X_(gt_op, >) X_(lt_op, <) X_(mod_op, %)

Definition at line 46 of file default_plural_forms_expressions.hpp.

◆ FOREACH_SPIRIT_PO_CONJUNCTION

#define FOREACH_SPIRIT_PO_CONJUNCTION (   X_)     X_(and_op, &&) X_(or_op, ||)

Definition at line 51 of file default_plural_forms_expressions.hpp.

◆ FWD_DECL_

#define FWD_DECL_ (   name,
  op 
)    struct name ; \

Definition at line 63 of file default_plural_forms_expressions.hpp.

◆ MACHINE_ASSERT

#define MACHINE_ASSERT (   ...)    do {} while(0)

◆ STACK_MACHINE_CASE_

#define STACK_MACHINE_CASE_ (   name,
  op 
)
Value:
case op_code::name: { \
MACHINE_ASSERT(stack_.size() >= 2); \
uint parm2 = pop_one(); \
\
if (op_code::name == op_code::mod_op) { \
MACHINE_ASSERT(parm2 && "Division by zero when evaluating gettext plural form expression"); \
} \
\
stack_.back() = (stack_.back() op parm2); \
return 1; \
}

◆ WRAP_

#define WRAP_ (   name,
  op 
)    boost::recursive_wrapper< name >, \

Definition at line 75 of file default_plural_forms_expressions.hpp.