载入中...
搜索中...
未找到

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()

const AssetRef * eve::ResourceRef::asset ( ) const
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()

const DefinitionRef * eve::ResourceRef::definition ( ) const
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()

static ResourceRef eve::ResourceRef::fromAsset ( AssetRef  value)
inlinestatic

Wrap an asset reference in the generic reference union.

在文件 ResourceRef.h 第 154 行定义.

引用了 value.

◆ fromDefinition()

static ResourceRef eve::ResourceRef::fromDefinition ( DefinitionRef  value)
inlinestatic

Wrap a definition reference in the generic reference union.

在文件 ResourceRef.h 第 160 行定义.

引用了 value.

◆ fromObject()

static ResourceRef eve::ResourceRef::fromObject ( ObjectRef  value)
inlinestatic

Wrap an object reference in the generic reference union.

在文件 ResourceRef.h 第 163 行定义.

引用了 value.

◆ fromUri()

static ResourceRef eve::ResourceRef::fromUri ( ResourceUri  value)
inlinestatic

Wrap a resource URI in the generic reference union.

在文件 ResourceRef.h 第 157 行定义.

引用了 value.

◆ kind()

ResourceRefKind eve::ResourceRef::kind ( ) const
noexcept

Return the active reference kind.

在文件 ResourceRef.cpp 第 78 行定义.

引用了 eve::Asset, eve::Definition, eve::Object , 以及 eve::Uri.

◆ object()

const ObjectRef * eve::ResourceRef::object ( ) const
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()

Result< ResourceRef > eve::ResourceRef::parse ( std::string_view  text)
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()

const ResourceUri * eve::ResourceRef::uri ( ) const
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==

bool operator== ( const ResourceRef &  ,
const ResourceRef &   
)
friend

Compare generic references including their active kind.


该类的文档由以下文件生成: