Generic owning collection of canonical attributes and modifiers. 更多...
#include <AttributeSet.h>
Public 成员函数 | |
| AttributeSet (std::string subject={}) | |
| Construct a set associated with an optional stable subject id. | |
| ~AttributeSet () | |
| Withdraw world-state capability listeners. | |
| AttributeSet (const AttributeSet &other) | |
| Copy a set while rebuilding its internal borrowed enumeration view. | |
| AttributeSet & | operator= (const AttributeSet &other) |
| Copy a set while rebuilding its internal borrowed enumeration view. | |
| AttributeSet (AttributeSet &&other) noexcept | |
| Move a set while rebuilding its internal borrowed enumeration view. | |
| AttributeSet & | operator= (AttributeSet &&other) noexcept |
| Move-assign a set while rebuilding its internal borrowed enumeration view. | |
| const std::string & | subject () const |
| Stable game-defined id of the entity or object owning this set. | |
| void | setBase (const AttributeId &attribute, double value) |
| Set or replace a base value. Empty attribute ids are ignored for compatibility. | |
| void | modifyBase (const AttributeId &attribute, double delta) |
| Add delta to a base value, creating it from zero when absent. | |
| bool | has (const AttributeId &attribute) const |
| Return whether a base value or modifier names the attribute. | |
| double | getBase (const AttributeId &attribute, double fallback=0.0) const |
| Return a base value, or fallback when absent. | |
| double | getFinal (const AttributeId &attribute, double fallback=0.0, const AttributeOperationRegistry *customOperations=nullptr) const |
| Return the deterministic final value after all modifiers. | |
| eve::Result< ModifierId > | addModifier (AttributeModifier modifier) |
| Add or replace a canonical modifier and return its stable id. | |
| bool | addModifier (const std::string &id, const std::string &attribute, const std::string &source, const std::string &operation, double value, ModifierPriority priority=0) |
| Compatibility facade for the former string operation API. | |
| eve::Result< void > | removeModifier (const ModifierId &id) |
| Remove one modifier with a structured result. | |
| eve::Result< void > | removeModifier (const AttributeId &attribute, const ModifierId &id) |
| Remove one modifier from a named attribute with a structured result. | |
| eve::Result< int > | removeBySource (const SourceId &source, const AttributeId &attribute={}) |
| Remove source modifiers with a structured result containing the count. | |
| void | invalidate (const AttributeId &attribute) |
| Mark one attribute dirty after an external policy or restore change. | |
| void | clearModifiers () |
| Remove all modifiers. | |
| int | modifierCount () const |
| Number of modifiers. | |
| const AttributeModifier * | modifierAt (int index) const |
| Return a modifier by deterministic sequence order, or null when out of range. | |
| int | attributeCount () const |
| Number of named attribute values, including modifier-only values. | |
| std::string | attributeAt (int index) const |
| Return an attribute id in deterministic lexical order, or an empty string. | |
详细描述
Generic owning collection of canonical attributes and modifiers.
在文件 AttributeSet.h 第 160 行定义.
构造及析构函数说明
◆ AttributeSet() [1/3]
|
explicit |
Construct a set associated with an optional stable subject id.
在文件 AttributeSet.cpp 第 162 行定义.
◆ ~AttributeSet()
| eve::attributes::AttributeSet::~AttributeSet | ( | ) |
Withdraw world-state capability listeners.
在文件 AttributeSet.cpp 第 164 行定义.
◆ AttributeSet() [2/3]
| eve::attributes::AttributeSet::AttributeSet | ( | const AttributeSet & | other | ) |
Copy a set while rebuilding its internal borrowed enumeration view.
在文件 AttributeSet.cpp 第 166 行定义.
◆ AttributeSet() [3/3]
|
noexcept |
Move a set while rebuilding its internal borrowed enumeration view.
在文件 AttributeSet.cpp 第 186 行定义.
成员函数说明
◆ addModifier() [1/2]
| eve::Result< ModifierId > eve::attributes::AttributeSet::addModifier | ( | AttributeModifier | modifier | ) |
Add or replace a canonical modifier and return its stable id.
- 返回
- Rejected for invalid attribute/custom policy data; the returned id is owned by the Result and remains valid for this set.
在文件 AttributeSet.cpp 第 262 行定义.
引用了 eve::Applied, eve::attributes::AttributeModifier::attribute, eve::Result< T >::failure(), eve::attributes::AttributeModifier::id, eve::Result< void >::ignore(), removeModifier(), eve::attributes::AttributeModifier::sequence, state, eve::Status::success(), eve::Result< T >::success() , 以及 eve::attributes::AttributeModifier::value.
被这些函数引用 eve::attributes::AttributeProjection::addModifier(), addModifier() , 以及 eve::attributes::AttributeProjection::restore().
◆ addModifier() [2/2]
| bool eve::attributes::AttributeSet::addModifier | ( | const std::string & | id, |
| const std::string & | attribute, | ||
| const std::string & | source, | ||
| const std::string & | operation, | ||
| double | value, | ||
| ModifierPriority | priority = 0 |
||
| ) |
Compatibility facade for the former string operation API.
- 返回
- false only for invalid legacy input; canonical computation still happens in addModifier(AttributeModifier).
在文件 AttributeSet.cpp 第 295 行定义.
引用了 addModifier(), id, operation, eve::attributes::parseAttributeOperation(), priority, source , 以及 value.
◆ attributeAt()
| std::string eve::attributes::AttributeSet::attributeAt | ( | int | index | ) | const |
Return an attribute id in deterministic lexical order, or an empty string.
在文件 AttributeSet.cpp 第 401 行定义.
◆ attributeCount()
| int eve::attributes::AttributeSet::attributeCount | ( | ) | const |
Number of named attribute values, including modifier-only values.
在文件 AttributeSet.cpp 第 399 行定义.
◆ clearModifiers()
| void eve::attributes::AttributeSet::clearModifiers | ( | ) |
◆ getBase()
| double eve::attributes::AttributeSet::getBase | ( | const AttributeId & | attribute, |
| double | fallback = 0.0 |
||
| ) | const |
Return a base value, or fallback when absent.
在文件 AttributeSet.cpp 第 231 行定义.
被这些函数引用 eve::combat::CombatAttributeRuntime::advance(), eve::combat::CombatAttributeRuntime::modify(), eve::attributes::AttributeProjection::snapshot() , 以及 eve::combat::CombatAttributeRuntime::value().
◆ getFinal()
| double eve::attributes::AttributeSet::getFinal | ( | const AttributeId & | attribute, |
| double | fallback = 0.0, |
||
| const AttributeOperationRegistry * | customOperations = nullptr |
||
| ) | const |
Return the deterministic final value after all modifiers.
- 参数
-
customOperations Optional borrowed policy registry. When supplied, custom policies are evaluated and the value is not cached across registry changes.
在文件 AttributeSet.cpp 第 236 行定义.
引用了 eve::attributes::computeAttributeValue() , 以及 state.
被这些函数引用 eve::attributes::AttributeSetStateAdapter::apply(), eve::attributes::AttributeProjection::getFinal() , 以及 eve::attributes::AttributeSetStateAdapter::value().
◆ has()
| bool eve::attributes::AttributeSet::has | ( | const AttributeId & | attribute | ) | const |
Return whether a base value or modifier names the attribute.
在文件 AttributeSet.cpp 第 227 行定义.
被这些函数引用 eve::attributes::AttributeSetStateAdapter::apply(), eve::attributes::AttributeProjection::has() , 以及 eve::attributes::AttributeSetStateAdapter::value().
◆ invalidate()
| void eve::attributes::AttributeSet::invalidate | ( | const AttributeId & | attribute | ) |
Mark one attribute dirty after an external policy or restore change.
在文件 AttributeSet.cpp 第 363 行定义.
◆ modifierAt()
| const AttributeModifier * eve::attributes::AttributeSet::modifierAt | ( | int | index | ) | const |
Return a modifier by deterministic sequence order, or null when out of range.
在文件 AttributeSet.cpp 第 393 行定义.
引用了 index.
◆ modifierCount()
| int eve::attributes::AttributeSet::modifierCount | ( | ) | const |
Number of modifiers.
在文件 AttributeSet.cpp 第 377 行定义.
◆ modifyBase()
| void eve::attributes::AttributeSet::modifyBase | ( | const AttributeId & | attribute, |
| double | delta | ||
| ) |
Add delta to a base value, creating it from zero when absent.
在文件 AttributeSet.cpp 第 219 行定义.
引用了 state.
被这些函数引用 eve::attributes::AttributeSetStateAdapter::apply() , 以及 eve::attributes::AttributeProjection::modifyBase().
◆ operator=() [1/2]
|
noexcept |
Move-assign a set while rebuilding its internal borrowed enumeration view.
在文件 AttributeSet.cpp 第 195 行定义.
◆ operator=() [2/2]
| AttributeSet & eve::attributes::AttributeSet::operator= | ( | const AttributeSet & | other | ) |
Copy a set while rebuilding its internal borrowed enumeration view.
在文件 AttributeSet.cpp 第 174 行定义.
◆ removeBySource()
| eve::Result< int > eve::attributes::AttributeSet::removeBySource | ( | const SourceId & | source, |
| const AttributeId & | attribute = {} |
||
| ) |
Remove source modifiers with a structured result containing the count.
在文件 AttributeSet.cpp 第 344 行定义.
引用了 eve::Applied, code, eve::Result< T >::failure(), eve::NoOp, removed, source, state, eve::Status::success() , 以及 eve::Result< T >::success().
◆ removeModifier() [1/2]
| eve::Result< void > eve::attributes::AttributeSet::removeModifier | ( | const AttributeId & | attribute, |
| const ModifierId & | id | ||
| ) |
Remove one modifier from a named attribute with a structured result.
在文件 AttributeSet.cpp 第 322 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Status::failure(), eve::NotFound, eve::Status::success() , 以及 eve::Result< T >::success().
◆ removeModifier() [2/2]
| eve::Result< void > eve::attributes::AttributeSet::removeModifier | ( | const ModifierId & | id | ) |
Remove one modifier with a structured result.
在文件 AttributeSet.cpp 第 305 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Status::failure(), eve::NotFound, state, eve::Status::success() , 以及 eve::Result< T >::success().
被这些函数引用 addModifier() , 以及 eve::attributes::AttributeProjection::restore().
◆ setBase()
| void eve::attributes::AttributeSet::setBase | ( | const AttributeId & | attribute, |
| double | value | ||
| ) |
Set or replace a base value. Empty attribute ids are ignored for compatibility.
在文件 AttributeSet.cpp 第 211 行定义.
被这些函数引用 eve::attributes::AttributeSetStateAdapter::apply(), eve::attributes::AttributeProjection::initialize(), eve::combat::CombatAttributeRuntime::registerAttribute(), eve::attributes::AttributeProjection::restore() , 以及 eve::attributes::AttributeProjection::setBase().
◆ subject()
| const std::string & eve::attributes::AttributeSet::subject | ( | ) | const |
Stable game-defined id of the entity or object owning this set.
在文件 AttributeSet.cpp 第 209 行定义.
该类的文档由以下文件生成:
- src/modules/attributes/AttributeSet.h
- src/modules/attributes/AttributeSet.cpp