载入中...
搜索中...
未找到
eve::decision::Condition类 参考

Immutable condition AST node. 更多...

#include <Condition.h>

Public 成员函数

 Condition ()=default
 Construct an empty All node, which passes vacuously.
 
ConditionKind kind () const noexcept
 Return this node's kind.
 
const std::vector< Condition > & children () const noexcept
 Return owned children; empty for a leaf node.
 
const std::string & key () const noexcept
 Return the key/tag/scope/name used by a leaf, if applicable.
 
CompareOperator compareOperator () const noexcept
 Return the comparison operator used by Compare.
 
const Value & expected () const noexcept
 Return the expected value owned by Compare/StateEquals.
 
const Value & arguments () const noexcept
 Return owned PolicyCall arguments.
 
const std::optional< ScriptConditionDeclaration > & scriptDeclaration () const noexcept
 Return an optional script dependency/determinism declaration.
 
bool isValid () const noexcept
 Return whether the factory invariants for this node hold.
 
ConditionResult evaluate (const EvaluationContext &context) const
 Evaluate this tree against a read-only context.
 

静态 Public 成员函数

static Condition all (std::vector< Condition > children)
 Construct a conjunction of child conditions.
 
static Condition any (std::vector< Condition > children)
 Construct a disjunction of child conditions.
 
static Condition not_ (Condition child)
 Construct a logical negation of one child condition.
 
static Condition compare (std::string key, CompareOperator op, Value expected)
 Compare a context value against an expected scalar value.
 
static Condition hasTag (std::string tag)
 Require a tag to be present.
 
static Condition hasAttribute (std::string attribute)
 Require an attribute to exist.
 
static Condition hasResource (std::string resource)
 Require a resource to exist.
 
static Condition stateEquals (std::string key, Value expected)
 Require a named state value to equal the expected value.
 
static Condition authorityCheck (std::string scope)
 Require read-only authority for a scope.
 
static Condition policyCall (std::string name, Value arguments=Value::Object{}, std::optional< ScriptConditionDeclaration > scriptDeclaration=std::nullopt)
 Call a named read-only policy and use its ConditionResult.
 

详细描述

Immutable condition AST node.

Construct nodes through the named factories. A node owns all child nodes, keys and values; it keeps no pointers into a domain object. Evaluation is synchronous, const, and side-effect free.

在文件 Condition.h 第 195 行定义.

构造及析构函数说明

◆ Condition()

eve::decision::Condition::Condition ( )
default

Construct an empty All node, which passes vacuously.

成员函数说明

◆ all()

Condition eve::decision::Condition::all ( std::vector< Condition >  children)
static

Construct a conjunction of child conditions.

在文件 Condition.cpp 第 141 行定义.

引用了 eve::decision::All , 以及 children().

◆ any()

Condition eve::decision::Condition::any ( std::vector< Condition >  children)
static

Construct a disjunction of child conditions.

在文件 Condition.cpp 第 147 行定义.

引用了 eve::decision::Any , 以及 children().

◆ arguments()

const Value & eve::decision::Condition::arguments ( ) const
inlinenoexcept

Return owned PolicyCall arguments.

在文件 Condition.h 第 239 行定义.

被这些函数引用 policyCall().

◆ authorityCheck()

Condition eve::decision::Condition::authorityCheck ( std::string  scope)
static

Require read-only authority for a scope.

在文件 Condition.cpp 第 192 行定义.

引用了 eve::decision::AuthorityCheck , 以及 scope.

◆ children()

const std::vector< Condition > & eve::decision::Condition::children ( ) const
inlinenoexcept

Return owned children; empty for a leaf node.

在文件 Condition.h 第 231 行定义.

被这些函数引用 all() , 以及 any().

◆ compare()

Condition eve::decision::Condition::compare ( std::string  key,
CompareOperator  op,
Value  expected 
)
static

Compare a context value against an expected scalar value.

在文件 Condition.cpp 第 159 行定义.

引用了 eve::decision::Compare, expected() , 以及 key().

◆ compareOperator()

CompareOperator eve::decision::Condition::compareOperator ( ) const
inlinenoexcept

Return the comparison operator used by Compare.

在文件 Condition.h 第 235 行定义.

◆ evaluate()

◆ expected()

const Value & eve::decision::Condition::expected ( ) const
inlinenoexcept

Return the expected value owned by Compare/StateEquals.

在文件 Condition.h 第 237 行定义.

被这些函数引用 compare() , 以及 stateEquals().

◆ hasAttribute()

Condition eve::decision::Condition::hasAttribute ( std::string  attribute)
static

Require an attribute to exist.

在文件 Condition.cpp 第 173 行定义.

引用了 eve::decision::HasAttribute.

◆ hasResource()

Condition eve::decision::Condition::hasResource ( std::string  resource)
static

Require a resource to exist.

在文件 Condition.cpp 第 179 行定义.

引用了 eve::decision::HasResource , 以及 resource.

◆ hasTag()

Condition eve::decision::Condition::hasTag ( std::string  tag)
static

Require a tag to be present.

在文件 Condition.cpp 第 167 行定义.

引用了 eve::decision::HasTag , 以及 tag.

◆ isValid()

bool eve::decision::Condition::isValid ( ) const
noexcept

◆ key()

const std::string & eve::decision::Condition::key ( ) const
inlinenoexcept

Return the key/tag/scope/name used by a leaf, if applicable.

在文件 Condition.h 第 233 行定义.

被这些函数引用 compare() , 以及 stateEquals().

◆ kind()

ConditionKind eve::decision::Condition::kind ( ) const
inlinenoexcept

Return this node's kind.

在文件 Condition.h 第 229 行定义.

◆ not_()

Condition eve::decision::Condition::not_ ( Condition  child)
static

Construct a logical negation of one child condition.

在文件 Condition.cpp 第 153 行定义.

引用了 eve::decision::Not.

◆ policyCall()

Condition eve::decision::Condition::policyCall ( std::string  name,
Value  arguments = Value::Object{},
std::optional< ScriptConditionDeclaration >  scriptDeclaration = std::nullopt 
)
static

Call a named read-only policy and use its ConditionResult.

参数
nameStable policy/script name.
argumentsOwning policy arguments; defaults to an empty object.
scriptDeclarationOptional dependency/determinism declaration for a script-backed policy. Its name must match name when supplied.

在文件 Condition.cpp 第 198 行定义.

引用了 arguments(), name, eve::decision::PolicyCall , 以及 scriptDeclaration().

◆ scriptDeclaration()

const std::optional< ScriptConditionDeclaration > & eve::decision::Condition::scriptDeclaration ( ) const
inlinenoexcept

Return an optional script dependency/determinism declaration.

在文件 Condition.h 第 241 行定义.

被这些函数引用 policyCall().

◆ stateEquals()

Condition eve::decision::Condition::stateEquals ( std::string  key,
Value  expected 
)
static

Require a named state value to equal the expected value.

在文件 Condition.cpp 第 185 行定义.

引用了 expected(), key() , 以及 eve::decision::StateEquals.


该类的文档由以下文件生成: