载入中...
搜索中...
未找到
eve::condition 命名空间参考

类

class  Condition
 Immutable condition AST node. 更多...
 
class  ConditionResult
 Explain one condition evaluation in a UI- and log-friendly form. 更多...
 
class  EvaluationContext
 Read-only state boundary used by every condition evaluation. 更多...
 
struct  ScriptConditionDeclaration
 Metadata a script policy must declare before it is used by a condition. 更多...
 

枚举

enum class  ConditionKind : std::uint8_t {
  All , Any , Not , Compare ,
  PolicyCall
}
 Node kind in the side-effect-free condition AST. 更多...
 
enum class  CompareOperator : std::uint8_t {
  Equal , NotEqual , Less , LessEqual ,
  Greater , GreaterEqual , Exists
}
 Scalar comparison used by a Compare node. 更多...
 
enum class  DeterminismLevel : std::uint8_t { BitExact , TickDeterministic , ToleranceBounded , ExplicitlyNondeterministic }
 Determinism contract declared by a script-backed condition policy. 更多...
 
enum class  ConditionReasonCode : std::uint32_t {
  Passed = 0 , ChildFailed = 1 , NoChildPassed = 2 , Negated = 3 ,
  MissingValue = 4 , ValueMismatch = 5 , TagMissing = 6 , TagUnavailable = 7 ,
  AttributeMissing = 8 , ResourceMissing = 9 , StateMissing = 10 , StateMismatch = 11 ,
  AuthorityDenied = 12 , AuthorityUnavailable = 13 , PolicyRejected = 14 , PolicyUnavailable = 15 ,
  InvalidCondition = 16
}
 Stable machine-readable explanation code for a condition outcome. 更多...
 

函数

const char * conditionReasonCodeName (ConditionReasonCode code) noexcept
 Return the stable lowercase spelling of a condition reason code. @ownership Borrowed process-static text; callers must not free or modify it. @nullable Never null; unknown numeric values use the stable unknown-value literal. @lifetime Process lifetime. @thread Thread-safe and reentrant; no mutable state or callbacks are used.
 
const char * conditionKindName (ConditionKind kind) noexcept
 Return the stable lowercase spelling of a condition node kind. @ownership Borrowed process-static text; callers must not free or modify it. @nullable Never null; unknown numeric values use the stable unknown-value literal. @lifetime Process lifetime. @thread Thread-safe and reentrant; no mutable state or callbacks are used.
 
const char * compareOperatorName (CompareOperator op) noexcept
 Return the stable lowercase spelling of a comparison operator. @ownership Borrowed process-static text; callers must not free or modify it. @nullable Never null; unknown numeric values use the stable unknown-value literal. @lifetime Process lifetime. @thread Thread-safe and reentrant; no mutable state or callbacks are used.
 
eve::Result< eve::Value > encodeCondition (const Condition &condition)
 Encode one validated condition tree as an owning Value.
 
eve::Result< Condition > decodeCondition (const eve::Value &value)
 Decode one condition tree from an owning Value.
 
std::optional< std::string > authorityAllowScope (const Value &arguments)
 Extract the scope string from an authority.allow argument object.
 
std::string tagKey (std::string_view tag)
 Build a tag:<name> Compare key.
 
std::string attrKey (std::string_view name)
 Build an attr:<name> Compare key.
 
std::string resourceKey (std::string_view name)
 Build a resource:<name> Compare key.
 
std::string stateKey (std::string_view name)
 Build a state:<name> Compare key.
 
std::string authorityKey (std::string_view scope)
 Build an authority:<scope> dependency/watch key.
 
std::optional< std::string_view > stripPrefix (std::string_view key, std::string_view prefix)
 Strip a known domain prefix from a key.
 
Condition tagPresent (std::string tag)
 Compare that a tag key is present (tag:<name> == true).
 
Condition attributeExists (std::string name)
 Compare that an attribute key exists (attr:<name> Exists).
 
Condition resourceExists (std::string name)
 Compare that a resource key exists (resource:<name> Exists).
 
Condition stateEquals (std::string name, Value expected)
 Compare that a state key equals an expected value.
 
Condition authorityAllow (std::string scope)
 PolicyCall for read-only authority (authority.allow).
 
template<class AuthorityQuery >
std::optional< ConditionResult > resolveAuthorityAllow (std::string_view name, const Value &arguments, AuthorityQuery &&authorityQuery)
 Resolve the built-in authority.allow policy when name matches.
 

变量

constexpr std::string_view kTagPrefix = "tag:"
 Prefix for tag membership booleans (tag:<name>).
 
constexpr std::string_view kAttrPrefix = "attr:"
 Prefix for attribute values (attr:<name>).
 
constexpr std::string_view kResourcePrefix = "resource:"
 Prefix for resource values (resource:<name>).
 
constexpr std::string_view kStatePrefix = "state:"
 Prefix for state values (state:<name>).
 
constexpr std::string_view kAuthorityPrefix = "authority:"
 Prefix for authority scopes used as watch/dependency keys.
 
constexpr std::string_view kPolicyPrefix = "policy:"
 Prefix for policy watch keys (policy:<name>).
 
constexpr std::string_view kAuthorityAllowPolicy = "authority.allow"
 PolicyCall name for read-only authority checks.
 

枚举类型说明

◆ CompareOperator

enum class eve::condition::CompareOperator : std::uint8_t
strong

Scalar comparison used by a Compare node.

枚举值
Equal 
NotEqual 
Less 
LessEqual 
Greater 
GreaterEqual 
Exists 

Passes when the keyed value is present; expected is ignored.

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

◆ ConditionKind

enum class eve::condition::ConditionKind : std::uint8_t
strong

Node kind in the side-effect-free condition AST.

枚举值
All 
Any 
Not 
Compare 
PolicyCall 

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

◆ ConditionReasonCode

enum class eve::condition::ConditionReasonCode : std::uint32_t
strong

Stable machine-readable explanation code for a condition outcome.

Active evaluation paths emit Passed, ChildFailed, NoChildPassed, Negated, MissingValue, ValueMismatch, PolicyRejected, PolicyUnavailable, AuthorityDenied, AuthorityUnavailable, and InvalidCondition. The remaining codes are retained for snapshot compatibility with older fact stores.

枚举值
Passed 
ChildFailed 
NoChildPassed 
Negated 
MissingValue 
ValueMismatch 
TagMissing 
TagUnavailable 
AttributeMissing 
ResourceMissing 
StateMissing 
StateMismatch 
AuthorityDenied 
AuthorityUnavailable 
PolicyRejected 
PolicyUnavailable 
InvalidCondition 

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

◆ DeterminismLevel

enum class eve::condition::DeterminismLevel : std::uint8_t
strong

Determinism contract declared by a script-backed condition policy.

枚举值
BitExact 

Same inputs produce the same bits without an external clock.

TickDeterministic 

Deterministic when evaluated at the injected simulation tick.

ToleranceBounded 

Results may vary within a documented numeric tolerance.

ExplicitlyNondeterministic 

Result is intentionally not suitable for replay or lockstep.

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

函数说明

◆ attributeExists()

Condition eve::condition::attributeExists ( std::string  name)
inline

Compare that an attribute key exists (attr:<name> Exists).

参数
nameAttribute name without prefix.

在文件 ConditionKeys.h 第 106 行定义.

引用了 attrKey(), eve::condition::Condition::compare(), Exists , 以及 name.

◆ attrKey()

std::string eve::condition::attrKey ( std::string_view  name)
inline

Build an attr:<name> Compare key.

参数
nameNon-empty attribute name without a domain prefix.

在文件 ConditionKeys.h 第 49 行定义.

引用了 kAttrPrefix, key , 以及 name.

被这些函数引用 eve::dialogue::DialogueStateContext::attribute() , 以及 attributeExists().

◆ authorityAllow()

Condition eve::condition::authorityAllow ( std::string  scope)
inline

◆ authorityAllowScope()

EVENGINE_API_FOUNDATION std::optional< std::string > eve::condition::authorityAllowScope ( const Value &  arguments)

Extract the scope string from an authority.allow argument object.

参数
argumentsPolicyCall arguments.
返回
Non-empty scope text, or nullopt when the field is missing/invalid.

在文件 ConditionKeys.cpp 第 5 行定义.

引用了 eve::Value::find() , 以及 eve::Value::getIf().

被这些函数引用 resolveAuthorityAllow().

◆ authorityKey()

std::string eve::condition::authorityKey ( std::string_view  scope)
inline

Build an authority:<scope> dependency/watch key.

参数
scopeNon-empty authority scope without a domain prefix.

在文件 ConditionKeys.h 第 79 行定义.

引用了 kAuthorityPrefix, key , 以及 scope.

被这些函数引用 authorityAllow().

◆ compareOperatorName()

EVENGINE_API_FOUNDATION const char * eve::condition::compareOperatorName ( CompareOperator  op)
noexcept

Return the stable lowercase spelling of a comparison operator. @ownership Borrowed process-static text; callers must not free or modify it. @nullable Never null; unknown numeric values use the stable unknown-value literal. @lifetime Process lifetime. @thread Thread-safe and reentrant; no mutable state or callbacks are used.

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

引用了 Equal, Exists, Greater, GreaterEqual, Less, LessEqual , 以及 NotEqual.

被这些函数引用 encodeCondition().

◆ conditionKindName()

EVENGINE_API_FOUNDATION const char * eve::condition::conditionKindName ( ConditionKind  kind)
noexcept

Return the stable lowercase spelling of a condition node kind. @ownership Borrowed process-static text; callers must not free or modify it. @nullable Never null; unknown numeric values use the stable unknown-value literal. @lifetime Process lifetime. @thread Thread-safe and reentrant; no mutable state or callbacks are used.

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

引用了 All, Any, Compare, kind, Not , 以及 PolicyCall.

被这些函数引用 encodeCondition().

◆ conditionReasonCodeName()

EVENGINE_API_FOUNDATION const char * eve::condition::conditionReasonCodeName ( ConditionReasonCode  code)
noexcept

Return the stable lowercase spelling of a condition reason code. @ownership Borrowed process-static text; callers must not free or modify it. @nullable Never null; unknown numeric values use the stable unknown-value literal. @lifetime Process lifetime. @thread Thread-safe and reentrant; no mutable state or callbacks are used.

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

引用了 AttributeMissing, AuthorityDenied, AuthorityUnavailable, ChildFailed, code, InvalidCondition, MissingValue, Negated, NoChildPassed, Passed, PolicyRejected, PolicyUnavailable, ResourceMissing, StateMismatch, StateMissing, TagMissing, TagUnavailable , 以及 ValueMismatch.

被这些函数引用 eve::rpg::SkillSystem::canCast(), eve::dialogue::DialogueFlow::configureIntegration() , 以及 eve::card::CardPlayPaymentAdapter::play().

◆ decodeCondition()

EVENGINE_API_FOUNDATION eve::Result< Condition > eve::condition::decodeCondition ( const eve::Value &  value)

Decode one condition tree from an owning Value.

参数
valueNode-shaped Value; legacy leaf kinds are expanded.
返回
Validated condition tree, or a structured parse failure.

在文件 ConditionCodec.cpp 第 298 行定义.

引用了 value.

被这些函数引用 eve::emergence::decodeCondition() , 以及 eve::rpg::decodeSkillCondition().

◆ encodeCondition()

EVENGINE_API_FOUNDATION eve::Result< eve::Value > eve::condition::encodeCondition ( const Condition &  condition)

Encode one validated condition tree as an owning Value.

参数
conditionImmutable condition tree to encode.
返回
Node-shaped Value, or InvalidArgument when the tree is invalid.

在文件 ConditionCodec.cpp 第 258 行定义.

引用了 All, Any, children, Compare, compareOperatorName(), condition, conditionKindName(), encodeCondition(), eve::Diagnostic::error(), Exists, eve::Result< T >::failure(), eve::InvalidArgument, eve::Value::isNull(), eve::Value::kind(), Not, PolicyCall , 以及 eve::Result< T >::success().

被这些函数引用 encodeCondition() , 以及 eve::rpg::encodeSkillCondition().

◆ resolveAuthorityAllow()

template<class AuthorityQuery >
std::optional< ConditionResult > eve::condition::resolveAuthorityAllow ( std::string_view  name,
const Value &  arguments,
AuthorityQuery &&  authorityQuery 
)

Resolve the built-in authority.allow policy when name matches.

参数
namePolicy name from PolicyCall.
argumentsPolicy arguments; requires a non-empty string scope.
authorityQueryReturns known grant, or nullopt when the authority source is unavailable for that scope.
返回
A ConditionResult when this is the authority policy; nullopt when name is a different policy the caller should handle.

在文件 ConditionKeys.h 第 158 行定义.

引用了 authorityAllowScope(), AuthorityDenied, AuthorityUnavailable, eve::condition::ConditionResult::failed(), InvalidCondition, kAuthorityAllowPolicy, name, scope , 以及 eve::condition::ConditionResult::success().

被这些函数引用 eve::card::CardPlayConditionContext::policy(), eve::dialogue::StateEvaluationContext::policy(), eve::emergence::FactStore::policy() , 以及 eve::rpg::SkillConditionContext::policy().

◆ resourceExists()

Condition eve::condition::resourceExists ( std::string  name)
inline

Compare that a resource key exists (resource:<name> Exists).

参数
nameResource name without prefix.

在文件 ConditionKeys.h 第 114 行定义.

引用了 eve::condition::Condition::compare(), Exists, name , 以及 resourceKey().

◆ resourceKey()

std::string eve::condition::resourceKey ( std::string_view  name)
inline

Build a resource:<name> Compare key.

参数
nameNon-empty resource name without a domain prefix.

在文件 ConditionKeys.h 第 59 行定义.

引用了 key, kResourcePrefix , 以及 name.

被这些函数引用 eve::dialogue::DialogueStateContext::resource() , 以及 resourceExists().

◆ stateEquals()

Condition eve::condition::stateEquals ( std::string  name,
Value  expected 
)
inline

Compare that a state key equals an expected value.

参数
nameState name without prefix.
expectedExpected scalar or structured value.

在文件 ConditionKeys.h 第 123 行定义.

引用了 eve::condition::Condition::compare(), Equal, name , 以及 stateKey().

◆ stateKey()

std::string eve::condition::stateKey ( std::string_view  name)
inline

Build a state:<name> Compare key.

参数
nameNon-empty state name without a domain prefix.

在文件 ConditionKeys.h 第 69 行定义.

引用了 key, kStatePrefix , 以及 name.

被这些函数引用 eve::dialogue::DialogueStateContext::state() , 以及 stateEquals().

◆ stripPrefix()

std::optional< std::string_view > eve::condition::stripPrefix ( std::string_view  key,
std::string_view  prefix 
)
inline

Strip a known domain prefix from a key.

返回
The remainder when key starts with prefix; otherwise nullopt.

在文件 ConditionKeys.h 第 89 行定义.

引用了 key.

被这些函数引用 eve::card::CardPlayConditionContext::value(), eve::dialogue::StateEvaluationContext::value(), eve::emergence::FactStore::value() , 以及 eve::rpg::SkillConditionContext::value().

◆ tagKey()

std::string eve::condition::tagKey ( std::string_view  tag)
inline

Build a tag:<name> Compare key.

参数
tagNon-empty tag name without a domain prefix.

在文件 ConditionKeys.h 第 39 行定义.

引用了 key, kTagPrefix , 以及 tag.

被这些函数引用 eve::dialogue::DialogueStateContext::hasTag() , 以及 tagPresent().

◆ tagPresent()

Condition eve::condition::tagPresent ( std::string  tag)
inline

Compare that a tag key is present (tag:<name> == true).

参数
tagTag name without prefix.

在文件 ConditionKeys.h 第 98 行定义.

引用了 eve::condition::Condition::compare(), Equal, tag , 以及 tagKey().

变量说明

◆ kAttrPrefix

constexpr std::string_view eve::condition::kAttrPrefix = "attr:"
inlineconstexpr

◆ kAuthorityAllowPolicy

constexpr std::string_view eve::condition::kAuthorityAllowPolicy = "authority.allow"
inlineconstexpr

PolicyCall name for read-only authority checks.

在文件 ConditionKeys.h 第 33 行定义.

被这些函数引用 authorityAllow() , 以及 resolveAuthorityAllow().

◆ kAuthorityPrefix

constexpr std::string_view eve::condition::kAuthorityPrefix = "authority:"
inlineconstexpr

Prefix for authority scopes used as watch/dependency keys.

在文件 ConditionKeys.h 第 29 行定义.

被这些函数引用 authorityKey().

◆ kPolicyPrefix

constexpr std::string_view eve::condition::kPolicyPrefix = "policy:"
inlineconstexpr

Prefix for policy watch keys (policy:<name>).

在文件 ConditionKeys.h 第 31 行定义.

◆ kResourcePrefix

constexpr std::string_view eve::condition::kResourcePrefix = "resource:"
inlineconstexpr

◆ kStatePrefix

constexpr std::string_view eve::condition::kStatePrefix = "state:"
inlineconstexpr

◆ kTagPrefix

constexpr std::string_view eve::condition::kTagPrefix = "tag:"
inlineconstexpr