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/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. | |
| 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 | 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 第 199 行定义.
构造及析构函数说明
◆ Condition()
|
default |
Construct an empty All node, which passes vacuously.
成员函数说明
◆ all()
Construct a conjunction of child conditions.
在文件 Condition.cpp 第 139 行定义.
引用了 eve::condition::All, children() , 以及 condition.
◆ any()
Construct a disjunction of child conditions.
在文件 Condition.cpp 第 145 行定义.
引用了 eve::condition::Any, children() , 以及 condition.
◆ arguments()
|
inlinenoexcept |
◆ children()
|
inlinenoexcept |
◆ compare()
|
static |
Compare a context value against an expected scalar value.
- 参数
-
key Compare key; may use ConditionKeys prefixes. op Comparison operator; Exists ignores expected.expected Expected value for relational operators.
在文件 Condition.cpp 第 157 行定义.
引用了 eve::condition::Compare, condition, expected() , 以及 key().
被这些函数引用 eve::condition::attributeExists(), eve::condition::resourceExists(), eve::condition::stateEquals() , 以及 eve::condition::tagPresent().
◆ compareOperator()
|
inlinenoexcept |
Return the comparison operator used by Compare.
在文件 Condition.h 第 234 行定义.
◆ evaluate()
| ConditionResult eve::condition::Condition::evaluate | ( | const EvaluationContext & | context | ) | const |
Evaluate this tree against a read-only context.
在文件 Condition.cpp 第 187 行定义.
引用了 eve::condition::All, eve::condition::Any, eve::condition::ChildFailed, context, eve::condition::ConditionResult::failed(), eve::condition::InvalidCondition, isValid(), eve::condition::Negated, eve::condition::NoChildPassed, eve::condition::Not, object, result , 以及 eve::condition::ConditionResult::success().
◆ expected()
|
inlinenoexcept |
◆ isValid()
|
noexcept |
Return whether the factory invariants for this node hold.
在文件 Condition.cpp 第 174 行定义.
引用了 eve::condition::All, eve::condition::Any, eve::condition::Compare, eve::condition::Not , 以及 eve::condition::PolicyCall.
被这些函数引用 evaluate() , 以及 eve::action::ActionDefinition::validate().
◆ key()
|
inlinenoexcept |
◆ kind()
|
inlinenoexcept |
Return this node's kind.
在文件 Condition.h 第 228 行定义.
◆ not_()
Construct a logical negation of one child condition.
在文件 Condition.cpp 第 151 行定义.
引用了 condition , 以及 eve::condition::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 第 165 行定义.
引用了 arguments(), condition, name, eve::condition::PolicyCall , 以及 scriptDeclaration().
被这些函数引用 eve::condition::authorityAllow().
◆ scriptDeclaration()
|
inlinenoexcept |
Return an optional script dependency/determinism declaration.
在文件 Condition.h 第 240 行定义.
被这些函数引用 policyCall().
该类的文档由以下文件生成:
- src/engine/common/Condition.h
- src/engine/common/Condition.cpp