Crossfire Server, Trunk
inja::FunctionStorage Class Reference

Class for builtin functions and user-defined callbacks. More...

#include <inja.hpp>

+ Collaboration diagram for inja::FunctionStorage:

Data Structures

struct  FunctionData
 

Public Types

enum  Operation {
  Operation::Not, Operation::And, Operation::Or, Operation::In,
  Operation::Equal, Operation::NotEqual, Operation::Greater, Operation::GreaterEqual,
  Operation::Less, Operation::LessEqual, Operation::Add, Operation::Subtract,
  Operation::Multiplication, Operation::Division, Operation::Power, Operation::Modulo,
  Operation::AtId, Operation::At, Operation::Default, Operation::DivisibleBy,
  Operation::Even, Operation::Exists, Operation::ExistsInObject, Operation::First,
  Operation::Float, Operation::Int, Operation::IsArray, Operation::IsBoolean,
  Operation::IsFloat, Operation::IsInteger, Operation::IsNumber, Operation::IsObject,
  Operation::IsString, Operation::Last, Operation::Length, Operation::Lower,
  Operation::Max, Operation::Min, Operation::Odd, Operation::Range,
  Operation::Round, Operation::Sort, Operation::Upper, Operation::Super,
  Operation::Join, Operation::Callback, Operation::ParenLeft, Operation::ParenRight,
  Operation::None
}
 

Public Member Functions

void add_builtin (nonstd::string_view name, int num_args, Operation op)
 
void add_callback (nonstd::string_view name, int num_args, const CallbackFunction &callback)
 
FunctionData find_function (nonstd::string_view name, int num_args) const
 

Private Attributes

std::map< std::pair< std::string, int >, FunctionDatafunction_storage
 
const int VARIADIC {-1}
 

Detailed Description

Class for builtin functions and user-defined callbacks.

Definition at line 1574 of file inja.hpp.

Member Enumeration Documentation

◆ Operation

Enumerator
Not 
And 
Or 
In 
Equal 
NotEqual 
Greater 
GreaterEqual 
Less 
LessEqual 
Add 
Subtract 
Multiplication 
Division 
Power 
Modulo 
AtId 
At 
Default 
DivisibleBy 
Even 
Exists 
ExistsInObject 
First 
Float 
Int 
IsArray 
IsBoolean 
IsFloat 
IsInteger 
IsNumber 
IsObject 
IsString 
Last 
Length 
Lower 
Max 
Min 
Odd 
Range 
Round 
Sort 
Upper 
Super 
Join 
Callback 
ParenLeft 
ParenRight 
None 

Definition at line 1576 of file inja.hpp.

Member Function Documentation

◆ add_builtin()

void inja::FunctionStorage::add_builtin ( nonstd::string_view  name,
int  num_args,
Operation  op 
)
inline

Definition at line 1670 of file inja.hpp.

References give::name, and give::op.

◆ add_callback()

void inja::FunctionStorage::add_callback ( nonstd::string_view  name,
int  num_args,
const CallbackFunction callback 
)
inline

Definition at line 1674 of file inja.hpp.

References give::name.

Referenced by inja::Environment::add_callback(), and inja::Environment::add_void_callback().

+ Here is the caller graph for this function:

◆ find_function()

FunctionData inja::FunctionStorage::find_function ( nonstd::string_view  name,
int  num_args 
) const
inline

Definition at line 1678 of file inja.hpp.

References give::name, and None.

Referenced by inja::Parser::parse_expression(), and inja::Renderer::visit().

+ Here is the caller graph for this function:

Field Documentation

◆ function_storage

std::map<std::pair<std::string, int>, FunctionData> inja::FunctionStorage::function_storage
private

Definition at line 1637 of file inja.hpp.

◆ VARIADIC

const int inja::FunctionStorage::VARIADIC {-1}
private

Definition at line 1635 of file inja.hpp.


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