UI-neutral versioned definition asset and cross-reference model. 更多...
#include <DefinitionTarget.h>
Public 类型 | |
| using | ReferenceResolver = std::function< bool(const std::string &type, const std::string &id)> |
| using | SchemaValidator = std::function< std::vector< EditorDiagnostic >(const std::string &type, int version, const std::string &json)> |
Public 成员函数 | |
| DefinitionDocument (std::string type, std::string id, int version=1) | |
| Construct an empty JSON-object definition with stable identity. | |
| TargetId | targetId () const override |
| Target id. | |
| TargetDescriptor | describe () const override |
| Describe. | |
| void * | queryCapability (const CapabilityId &) override |
| Query an optional target capability. | |
| Result< void > | applyDomainOperation (const DomainOperation &operation) override |
| Applies domain operation. | |
| Result< void > | setJson (std::string json) |
| Atomically replace canonical payload text after basic JSON-shape validation. | |
| Result< void > | setVersion (int version) |
| Replace the schema version with a positive value. | |
| Result< void > | setReferences (std::vector< DefinitionReferenceField > references) |
| Replace editor-extracted cross-reference fields. | |
| Result< DomainOperation > | makeSetField (const std::string &field, const EditorValue &value) const |
| Plan a reversible top-level field assignment from a schema form. | |
| std::vector< EditorDiagnostic > | validate (const SchemaValidator &schema, const ReferenceResolver &references) const |
| Run schema and cross-reference diagnostics without mutating content. | |
| EditorValue | snapshotValue () const |
| Capture deterministic content for DocumentService persistence. | |
| Result< void > | loadSnapshot (const EditorValue &snapshot) |
| Atomically load a version-one editor snapshot. | |
| const std::string & | type () const |
| Return definition type/schema id. | |
| const std::string & | id () const |
| Return stable definition id. | |
| int | version () const |
| Return schema version. | |
| const std::string & | json () const |
| Return JSON payload text. | |
| editing::Revision | documentRevision () const |
| Return current editor revision. | |
Public 成员函数 继承自 eve::editing::EditableTargetState | |
| EditableTargetState (Revision initial=1) | |
| Constructs the shared state with an explicit initial revision. | |
| EditRegion | dirtyRegion () const override |
| Return the accumulated dirty region. | |
| void | clearDirtyRegion () override |
| Discard the dirty region; the revision does not change. | |
| std::uint64_t | revision () const override |
| Return the current revision. | |
| Revision | revisionValue () const noexcept |
| Return the revision as the shared protocol revision type. | |
Public 成员函数 继承自 eve::editing::IEditableTarget | |
| virtual | ~IEditableTarget ()=default |
| Releases IEditableTarget resources. | |
| template<class C > | |
| eve::OptionalRef< C > | capability () |
| Query a capability through its interface-owned stable identity. | |
| template<class C > | |
| eve::OptionalRef< const C > | capability () const |
| Capability. | |
| template<class C > | |
| C * | query () |
| Queries query. | |
| template<class C > | |
| const C * | query () const |
| Queries query. | |
Public 成员函数 继承自 eve::editing::IDomainOperationTarget | |
| ~IDomainOperationTarget () override=default | |
| Releases IDomainOperationTarget resources. | |
额外继承的成员函数 | |
Protected 成员函数 继承自 eve::editing::EditableTargetState | |
| void | widenDirty (int x, int y) |
| Widen the dirty region without advancing the revision. | |
| void | widenDirty (const EditRegion ®ion) |
| Widen the dirty region without advancing the revision. | |
| void | widenDirty () |
| Mark an unknown area dirty without advancing the revision. | |
| void | bumpRevision () |
| Advance the revision without touching the dirty region. | |
| void | setRevision (Revision revision) |
| Adopt a revision observed elsewhere, without advancing it. | |
| void | setDirtyRegion (const EditRegion ®ion) |
| Replace the dirty region wholesale, without advancing the revision. | |
| void | markDirty (int x, int y) |
| Include one cell in the dirty region and advance the revision. | |
| void | markDirty (const EditRegion ®ion) |
| Include a whole region and advance the revision. | |
| void | markDirty () |
| Mark an unknown area dirty and advance the revision. | |
详细描述
UI-neutral versioned definition asset and cross-reference model.
在文件 DefinitionTarget.h 第 33 行定义.
成员类型定义说明
◆ ReferenceResolver
| using eve::definitions_editing::DefinitionDocument::ReferenceResolver = std::function<bool(const std::string& type, const std::string& id)> |
在文件 DefinitionTarget.h 第 37 行定义.
◆ SchemaValidator
| using eve::definitions_editing::DefinitionDocument::SchemaValidator = std::function<std::vector<EditorDiagnostic>(const std::string& type, int version, const std::string& json)> |
在文件 DefinitionTarget.h 第 38 行定义.
构造及析构函数说明
◆ DefinitionDocument()
| eve::definitions_editing::DefinitionDocument::DefinitionDocument | ( | std::string | type, |
| std::string | id, | ||
| int | version = 1 |
||
| ) |
Construct an empty JSON-object definition with stable identity.
在文件 DefinitionTarget.cpp 第 31 行定义.
成员函数说明
◆ applyDomainOperation()
|
overridevirtual |
Applies domain operation.
实现了 eve::editing::IDomainOperationTarget.
在文件 DefinitionTarget.cpp 第 39 行定义.
引用了 eve::editing::EditableTargetState::bumpRevision(), eve::editing::editorValueFromJson(), eve::editing::editorValueToJson(), operation, path , 以及 eve::editing::EditableTargetState::widenDirty().
◆ describe()
|
overridevirtual |
◆ documentRevision()
|
inline |
Return current editor revision.
在文件 DefinitionTarget.h 第 78 行定义.
◆ id()
|
inline |
Return stable definition id.
在文件 DefinitionTarget.h 第 72 行定义.
被这些函数引用 eve::definitions_editing::DefinitionRuntimePublisher::publish().
◆ json()
|
inline |
Return JSON payload text.
在文件 DefinitionTarget.h 第 76 行定义.
被这些函数引用 eve::definitions_editing::DefinitionRuntimePublisher::publish(), eve::definitions_editing::DefinitionSchemaFormTarget::read(), setJson() , 以及 eve::definitions_editing::DefinitionSchemaFormTarget::validate().
◆ loadSnapshot()
| Result< void > eve::definitions_editing::DefinitionDocument::loadSnapshot | ( | const EditorValue & | snapshot | ) |
Atomically load a version-one editor snapshot.
在文件 DefinitionTarget.cpp 第 167 行定义.
引用了 id, eve::Result< void >::ok(), path, required, setJson(), setReferences(), type , 以及 value.
◆ makeSetField()
| Result< DomainOperation > eve::definitions_editing::DefinitionDocument::makeSetField | ( | const std::string & | field, |
| const EditorValue & | value | ||
| ) | const |
Plan a reversible top-level field assignment from a schema form.
在文件 DefinitionTarget.cpp 第 94 行定义.
引用了 current, eve::editing::editorValueFromJson(), operation, eve::editing::DomainOperation::type , 以及 value.
被这些函数引用 eve::definitions_editing::DefinitionSchemaFormTarget::makeSet().
◆ queryCapability()
|
inlineoverridevirtual |
Query an optional target capability.
- 返回
- Borrowed pointer owned by this target, or null. @lifetime Valid until this target is destroyed or mutated.
重载 eve::editing::IEditableTarget .
在文件 DefinitionTarget.h 第 49 行定义.
◆ setJson()
| Result< void > eve::definitions_editing::DefinitionDocument::setJson | ( | std::string | json | ) |
Atomically replace canonical payload text after basic JSON-shape validation.
在文件 DefinitionTarget.cpp 第 61 行定义.
引用了 eve::editing::EditableTargetState::bumpRevision(), json() , 以及 eve::editing::EditableTargetState::widenDirty().
被这些函数引用 loadSnapshot().
◆ setReferences()
| Result< void > eve::definitions_editing::DefinitionDocument::setReferences | ( | std::vector< DefinitionReferenceField > | references | ) |
Replace editor-extracted cross-reference fields.
在文件 DefinitionTarget.cpp 第 81 行定义.
引用了 eve::editing::EditableTargetState::bumpRevision(), paths, reference , 以及 eve::editing::EditableTargetState::widenDirty().
被这些函数引用 loadSnapshot().
◆ setVersion()
| Result< void > eve::definitions_editing::DefinitionDocument::setVersion | ( | int | version | ) |
Replace the schema version with a positive value.
在文件 DefinitionTarget.cpp 第 71 行定义.
引用了 eve::editing::EditableTargetState::bumpRevision(), version() , 以及 eve::editing::EditableTargetState::widenDirty().
◆ snapshotValue()
| EditorValue eve::definitions_editing::DefinitionDocument::snapshotValue | ( | ) | const |
Capture deterministic content for DocumentService persistence.
在文件 DefinitionTarget.cpp 第 157 行定义.
引用了 reference.
◆ targetId()
|
inlineoverridevirtual |
◆ type()
|
inline |
Return definition type/schema id.
在文件 DefinitionTarget.h 第 70 行定义.
被这些函数引用 eve::definitions_editing::DefinitionRuntimePublisher::publish() , 以及 eve::definitions_editing::DefinitionSchemaFormTarget::validate().
◆ validate()
| std::vector< EditorDiagnostic > eve::definitions_editing::DefinitionDocument::validate | ( | const SchemaValidator & | schema, |
| const ReferenceResolver & | references | ||
| ) | const |
Run schema and cross-reference diagnostics without mutating content.
在文件 DefinitionTarget.cpp 第 121 行定义.
引用了 eve::InvalidArgument, eve::NotFound, eve::PreconditionViolation, reference , 以及 eve::editing::ruleDiagnostic().
◆ version()
|
inline |
Return schema version.
在文件 DefinitionTarget.h 第 74 行定义.
被这些函数引用 eve::definitions_editing::DefinitionRuntimePublisher::publish(), setVersion() , 以及 eve::definitions_editing::DefinitionSchemaFormTarget::validate().
该类的文档由以下文件生成:
- src/modules/definitions/editing/DefinitionTarget.h
- src/modules/definitions/editing/DefinitionTarget.cpp
Public 成员函数 继承自