Type-safe union of the reference forms accepted by resource-facing APIs. 更多...
#include <ResourceRef.h>
Public 成员函数 | |
| ResourceRefKind | kind () const noexcept |
| Return the active reference kind. | |
| const AssetRef * | asset () const noexcept |
| Return the AssetRef when active, otherwise null. | |
| const ResourceUri * | uri () const noexcept |
| Return the ResourceUri when active, otherwise null. | |
| const DefinitionRef * | definition () const noexcept |
| Return the DefinitionRef when active, otherwise null. | |
| const ObjectRef * | object () const noexcept |
| Return the ObjectRef when active, otherwise null. | |
静态 Public 成员函数 | |
| static Result< ResourceRef > | parse (std::string_view text) |
Parse a resource URI, specializing asset://UUID as AssetRef. | |
| static ResourceRef | fromAsset (AssetRef value) |
| Wrap an asset reference in the generic reference union. | |
| static ResourceRef | fromUri (ResourceUri value) |
| Wrap a resource URI in the generic reference union. | |
| static ResourceRef | fromDefinition (DefinitionRef value) |
| Wrap a definition reference in the generic reference union. | |
| static ResourceRef | fromObject (ObjectRef value) |
| Wrap an object reference in the generic reference union. | |
友元 | |
| bool | operator== (const ResourceRef &, const ResourceRef &) noexcept=default |
| Compare generic references including their active kind. | |
详细描述
Type-safe union of the reference forms accepted by resource-facing APIs.
The variant keeps AssetRef, ResourceUri, DefinitionRef and ObjectRef distinguishable at compile time. parse() parses URI text only; use the named factories for definition and object references, which intentionally have different textual domains.
在文件 ResourceRef.h 第 148 行定义.
成员函数说明
◆ asset()
|
noexcept |
Return the AssetRef when active, otherwise null.
- 返回
- Borrowed pointer into this ResourceRef; nullptr when another kind is active. @ownership Borrowed; ResourceRef owns the referenced value. @nullable Yes. @lifetime Valid until this ResourceRef is destroyed or mutated. @thread Affine to the owning ResourceRef; no internal synchronization. @reentrancy Does not invoke callbacks.
在文件 ResourceRef.cpp 第 85 行定义.
被这些函数引用 parse().
◆ definition()
|
noexcept |
Return the DefinitionRef when active, otherwise null.
- 返回
- Borrowed pointer into this ResourceRef; nullptr when another kind is active. @ownership Borrowed; ResourceRef owns the referenced value. @nullable Yes. @lifetime Valid until this ResourceRef is destroyed or mutated. @thread Affine to the owning ResourceRef; no internal synchronization. @reentrancy Does not invoke callbacks.
在文件 ResourceRef.cpp 第 89 行定义.
◆ fromAsset()
|
inlinestatic |
◆ fromDefinition()
|
inlinestatic |
◆ fromObject()
|
inlinestatic |
◆ fromUri()
|
inlinestatic |
◆ kind()
|
noexcept |
Return the active reference kind.
在文件 ResourceRef.cpp 第 78 行定义.
引用了 eve::Asset, eve::Definition, eve::Object , 以及 eve::Uri.
◆ object()
|
noexcept |
Return the ObjectRef when active, otherwise null.
- 返回
- Borrowed pointer into this ResourceRef; nullptr when another kind is active. @ownership Borrowed; ResourceRef owns the referenced value. @nullable Yes. @lifetime Valid until this ResourceRef is destroyed or mutated. @thread Affine to the owning ResourceRef; no internal synchronization. @reentrancy Does not invoke callbacks.
在文件 ResourceRef.cpp 第 91 行定义.
◆ parse()
|
static |
Parse a resource URI, specializing asset://UUID as AssetRef.
在文件 ResourceRef.cpp 第 66 行定义.
引用了 asset(), eve::Asset, eve::AssetRef::fromUri(), eve::ResourceUri::parse(), eve::Result< T >::success(), text, uri() , 以及 value.
◆ uri()
|
noexcept |
Return the ResourceUri when active, otherwise null.
- 返回
- Borrowed pointer into this ResourceRef; nullptr when another kind is active. @ownership Borrowed; ResourceRef owns the referenced value. @nullable Yes. @lifetime Valid until this ResourceRef is destroyed or mutated. @thread Affine to the owning ResourceRef; no internal synchronization. @reentrancy Does not invoke callbacks.
在文件 ResourceRef.cpp 第 87 行定义.
被这些函数引用 parse().
友元及相关函数文档
◆ operator==
|
friend |
Compare generic references including their active kind.
该类的文档由以下文件生成:
- src/engine/common/ResourceRef.h
- src/engine/common/ResourceRef.cpp