Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
gettext_plural_form.cpp File Reference
#include "gettext_plural_form.h"
#include "util/string.h"
#include <type_traits>
+ Include dependency graph for gettext_plural_form.cpp:

Classes

struct  safe_divides< T >
 
struct  safe_modulus< T >
 

Typedefs

typedef std::pair< GettextPluralForm::Function, std::wstring_view > ParserResult
 
typedef ParserResult(* Parser) (std::wstring_view)
 

Functions

static GettextPluralForm::NumT identity (GettextPluralForm::NumT n)
 
static GettextPluralForm::NumT ternary_op (GettextPluralForm::NumT n, const GettextPluralForm::Function &cond, const GettextPluralForm::Function &val, const GettextPluralForm::Function &alt)
 
template<template< typename > typename Func, class... Args>
static GettextPluralForm::Function wrap_op (Args &&... args)
 
static ParserResult parse_expr (std::wstring_view str)
 
template<Parser Parser, template< typename > typename Operator>
static ParserResult reduce_ltr_single (const ParserResult &res, const std::wstring &pattern)
 
template<Parser Parser>
static ParserResult reduce_ltr (const ParserResult &res)
 
template<Parser Parser, template< typename > typename Operator, template< typename > typename... Operators>
static ParserResult reduce_ltr (const ParserResult &res, const std::wstring &pattern, const typename std::conditional< 1, std::wstring, Operators< GettextPluralForm::NumT > >::type &... patterns)
 
template<Parser Parser, template< typename > typename... Operators>
static ParserResult parse_ltr (std::wstring_view str, const typename std::conditional< 1, std::wstring, Operators< GettextPluralForm::NumT > >::type &... patterns)
 
static ParserResult parse_atomic (std::wstring_view str)
 
static ParserResult parse_parenthesized (std::wstring_view str)
 
static ParserResult parse_negation (std::wstring_view str)
 
static ParserResult parse_multiplicative (std::wstring_view str)
 
static ParserResult parse_additive (std::wstring_view str)
 
static ParserResult parse_comparison (std::wstring_view str)
 
static ParserResult parse_equality (std::wstring_view str)
 
static ParserResult parse_conjunction (std::wstring_view str)
 
static ParserResult parse_disjunction (std::wstring_view str)
 
static ParserResult parse_ternary (std::wstring_view str)
 
static GettextPluralForm::Function parse (std::wstring_view str)
 

Typedef Documentation

◆ Parser

typedef ParserResult(* Parser) (std::wstring_view)

◆ ParserResult

typedef std::pair<GettextPluralForm::Function, std::wstring_view> ParserResult

Function Documentation

◆ identity()

static GettextPluralForm::NumT identity ( GettextPluralForm::NumT n)
static

Referenced by parse_atomic().

+ Here is the caller graph for this function:

◆ parse()

static GettextPluralForm::Function parse ( std::wstring_view str)
static

References parse_expr().

Referenced by GettextPluralForm::GettextPluralForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_additive()

static ParserResult parse_additive ( std::wstring_view str)
static

References parse_ltr().

+ Here is the call graph for this function:

◆ parse_atomic()

static ParserResult parse_atomic ( std::wstring_view str)
static

References _, identity(), and trim().

Referenced by parse_parenthesized().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_comparison()

static ParserResult parse_comparison ( std::wstring_view str)
static

References parse_ltr().

+ Here is the call graph for this function:

◆ parse_conjunction()

static ParserResult parse_conjunction ( std::wstring_view str)
static

References parse_ltr().

+ Here is the call graph for this function:

◆ parse_disjunction()

static ParserResult parse_disjunction ( std::wstring_view str)
static

References parse_ltr().

Referenced by parse_ternary().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_equality()

static ParserResult parse_equality ( std::wstring_view str)
static

References parse_ltr().

+ Here is the call graph for this function:

◆ parse_expr()

static ParserResult parse_expr ( std::wstring_view str)
static

References parse_ternary(), and trim().

Referenced by parse(), and parse_parenthesized().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_ltr()

template<Parser Parser, template< typename > typename... Operators>
static ParserResult parse_ltr ( std::wstring_view str,
const typename std::conditional< 1, std::wstring, Operators< GettextPluralForm::NumT > >::type &... patterns )
static

References reduce_ltr(), and trim().

Referenced by parse_additive(), parse_comparison(), parse_conjunction(), parse_disjunction(), parse_equality(), and parse_multiplicative().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_multiplicative()

static ParserResult parse_multiplicative ( std::wstring_view str)
static

References parse_ltr().

+ Here is the call graph for this function:

◆ parse_negation()

static ParserResult parse_negation ( std::wstring_view str)
static

References parse_negation(), parse_parenthesized(), trim(), and wrap_op().

Referenced by parse_negation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_parenthesized()

static ParserResult parse_parenthesized ( std::wstring_view str)
static

References parse_atomic(), parse_expr(), and trim().

Referenced by parse_negation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_ternary()

static ParserResult parse_ternary ( std::wstring_view str)
static

References parse_disjunction(), parse_ternary(), ternary_op(), and trim().

Referenced by parse_expr(), and parse_ternary().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reduce_ltr() [1/2]

template<Parser Parser>
static ParserResult reduce_ltr ( const ParserResult & res)
static

Referenced by parse_ltr(), and reduce_ltr().

+ Here is the caller graph for this function:

◆ reduce_ltr() [2/2]

template<Parser Parser, template< typename > typename Operator, template< typename > typename... Operators>
static ParserResult reduce_ltr ( const ParserResult & res,
const std::wstring & pattern,
const typename std::conditional< 1, std::wstring, Operators< GettextPluralForm::NumT > >::type &... patterns )
static

References reduce_ltr(), and reduce_ltr_single().

+ Here is the call graph for this function:

◆ reduce_ltr_single()

template<Parser Parser, template< typename > typename Operator>
static ParserResult reduce_ltr_single ( const ParserResult & res,
const std::wstring & pattern )
static

References str_starts_with(), trim(), and wrap_op().

Referenced by reduce_ltr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ternary_op()

Referenced by parse_ternary().

+ Here is the caller graph for this function:

◆ wrap_op()

template<template< typename > typename Func, class... Args>
static GettextPluralForm::Function wrap_op ( Args &&... args)
static

Referenced by parse_negation(), and reduce_ltr_single().

+ Here is the caller graph for this function: