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()
|
default |
Construct an empty All node, which passes vacuously.
成员函数说明
◆ all()
Construct a conjunction of child conditions.
在文件 Condition.cpp 第 141 行定义.
引用了 eve::decision::All , 以及 children().
◆ any()
Construct a disjunction of child conditions.
在文件 Condition.cpp 第 147 行定义.
引用了 eve::decision::Any , 以及 children().
◆ arguments()
|
inlinenoexcept |
◆ authorityCheck()
|
static |
Require read-only authority for a scope.
在文件 Condition.cpp 第 192 行定义.
引用了 eve::decision::AuthorityCheck , 以及 scope.
◆ children()
|
inlinenoexcept |
◆ compare()
|
static |
Compare a context value against an expected scalar value.
在文件 Condition.cpp 第 159 行定义.
引用了 eve::decision::Compare, expected() , 以及 key().
◆ compareOperator()
|
inlinenoexcept |
Return the comparison operator used by Compare.
在文件 Condition.h 第 235 行定义.
◆ evaluate()
| ConditionResult eve::decision::Condition::evaluate | ( | const EvaluationContext & | context | ) | const |
Evaluate this tree against a read-only context.
在文件 Condition.cpp 第 228 行定义.
引用了 eve::decision::All, eve::decision::Any, eve::decision::ChildFailed, context, eve::decision::ConditionResult::failed(), eve::decision::InvalidCondition, isValid(), eve::decision::Negated, eve::decision::NoChildPassed, eve::decision::Not, object , 以及 eve::decision::ConditionResult::success().
◆ expected()
|
inlinenoexcept |
Return the expected value owned by Compare/StateEquals.
在文件 Condition.h 第 237 行定义.
被这些函数引用 compare() , 以及 stateEquals().
◆ hasAttribute()
|
static |
◆ hasResource()
|
static |
Require a resource to exist.
在文件 Condition.cpp 第 179 行定义.
引用了 eve::decision::HasResource , 以及 resource.
◆ hasTag()
|
static |
◆ isValid()
|
noexcept |
Return whether the factory invariants for this node hold.
在文件 Condition.cpp 第 207 行定义.
引用了 eve::decision::All, eve::decision::Any, eve::decision::AuthorityCheck, eve::decision::Compare, eve::decision::HasAttribute, eve::decision::HasResource, eve::decision::HasTag, eve::decision::Not, eve::decision::PolicyCall , 以及 eve::decision::StateEquals.
被这些函数引用 evaluate() , 以及 eve::action::ActionDefinition::validate().
◆ key()
|
inlinenoexcept |
Return the key/tag/scope/name used by a leaf, if applicable.
在文件 Condition.h 第 233 行定义.
被这些函数引用 compare() , 以及 stateEquals().
◆ kind()
|
inlinenoexcept |
Return this node's kind.
在文件 Condition.h 第 229 行定义.
◆ not_()
Construct a logical negation of one child condition.
在文件 Condition.cpp 第 153 行定义.
引用了 eve::decision::Not.
◆ policyCall()
|
static |
Call a named read-only policy and use its ConditionResult.
- 参数
-
name Stable policy/script name. arguments Owning policy arguments; defaults to an empty object. scriptDeclaration Optional dependency/determinism declaration for a script-backed policy. Its name must match namewhen supplied.
在文件 Condition.cpp 第 198 行定义.
引用了 arguments(), name, eve::decision::PolicyCall , 以及 scriptDeclaration().
◆ scriptDeclaration()
|
inlinenoexcept |
Return an optional script dependency/determinism declaration.
在文件 Condition.h 第 241 行定义.
被这些函数引用 policyCall().
◆ stateEquals()
Require a named state value to equal the expected value.
在文件 Condition.cpp 第 185 行定义.
引用了 expected(), key() , 以及 eve::decision::StateEquals.
该类的文档由以下文件生成:
- src/modules/decision/Condition.h
- src/modules/decision/Condition.cpp