载入中...
搜索中...
未找到
ConditionKeys.h
浏览该文件的文档.
89[[nodiscard]] inline std::optional<std::string_view> stripPrefix(std::string_view key, std::string_view prefix) {
124 return Condition::compare(stateKey(std::move(name)), CompareOperator::Equal, std::move(expected));
136 return Condition::policyCall(std::string(kAuthorityAllowPolicy), Value::Object{{"scope", Value(scope)}},
145[[nodiscard]] EVENGINE_API_FOUNDATION std::optional<std::string> authorityAllowScope(const Value& arguments);
158[[nodiscard]] std::optional<ConditionResult> resolveAuthorityAllow(std::string_view name, const Value& arguments,
Pure, explainable condition trees shared by gameplay domains.
static ConditionResult success(Value evidence={}, Value details=Value::Object{})
Construct a passed result with optional evidence and details.
Definition Condition.cpp:131
static ConditionResult failed(ConditionReasonCode reason, Value evidence={}, Value details=Value::Object{})
Construct a rejected result with a stable reason and explanation.
Definition Condition.cpp:135
static Condition compare(std::string key, CompareOperator op, Value expected={})
Compare a context value against an expected scalar value.
Definition Condition.cpp:157
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.
Definition Condition.cpp:165
Definition Condition.cpp:7
constexpr std::string_view kAuthorityPrefix
Prefix for authority scopes used as watch/dependency keys.
Definition ConditionKeys.h:29
Condition stateEquals(std::string name, Value expected)
Compare that a state key equals an expected value.
Definition ConditionKeys.h:123
std::string resourceKey(std::string_view name)
Build a resource:<name> Compare key.
Definition ConditionKeys.h:59
@ InvalidCondition
@ AuthorityDenied
@ AuthorityUnavailable
Condition attributeExists(std::string name)
Compare that an attribute key exists (attr:<name> Exists).
Definition ConditionKeys.h:106
constexpr std::string_view kResourcePrefix
Prefix for resource values (resource:<name>).
Definition ConditionKeys.h:25
std::string authorityKey(std::string_view scope)
Build an authority:<scope> dependency/watch key.
Definition ConditionKeys.h:79
constexpr std::string_view kPolicyPrefix
Prefix for policy watch keys (policy:<name>).
Definition ConditionKeys.h:31
constexpr std::string_view kStatePrefix
Prefix for state values (state:<name>).
Definition ConditionKeys.h:27
constexpr std::string_view kTagPrefix
Prefix for tag membership booleans (tag:<name>).
Definition ConditionKeys.h:21
std::optional< ConditionResult > resolveAuthorityAllow(std::string_view name, const Value &arguments, AuthorityQuery &&authorityQuery)
Resolve the built-in authority.allow policy when name matches.
Definition ConditionKeys.h:158
Condition tagPresent(std::string tag)
Compare that a tag key is present (tag:<name> == true).
Definition ConditionKeys.h:98
std::string stateKey(std::string_view name)
Build a state:<name> Compare key.
Definition ConditionKeys.h:69
@ BitExact
Same inputs produce the same bits without an external clock.
Condition resourceExists(std::string name)
Compare that a resource key exists (resource:<name> Exists).
Definition ConditionKeys.h:114
std::optional< std::string_view > stripPrefix(std::string_view key, std::string_view prefix)
Strip a known domain prefix from a key.
Definition ConditionKeys.h:89
constexpr std::string_view kAttrPrefix
Prefix for attribute values (attr:<name>).
Definition ConditionKeys.h:23
std::string attrKey(std::string_view name)
Build an attr:<name> Compare key.
Definition ConditionKeys.h:49
@ Exists
Passes when the keyed value is present; expected is ignored.
Condition authorityAllow(std::string scope)
PolicyCall for read-only authority (authority.allow).
Definition ConditionKeys.h:131
std::optional< std::string > authorityAllowScope(const Value &arguments)
Extract the scope string from an authority.allow argument object.
Definition ConditionKeys.cpp:5
constexpr std::string_view kAuthorityAllowPolicy
PolicyCall name for read-only authority checks.
Definition ConditionKeys.h:33
std::string tagKey(std::string_view tag)
Build a tag:<name> Compare key.
Definition ConditionKeys.h:39
Metadata a script policy must declare before it is used by a condition.
Definition Condition.h:65
std::vector< std::string > dependencies
Logical state/query names read by the policy.
Definition Condition.h:69