AssetLinkInterface Class Reference

#include <assets.h>

Inheritance diagram for AssetLinkInterface:

Detailed Description

An AssetLink is a symbolic link to an asset identified by its id and version. Also an ASSET_UPDATE_POLICY is stored to control the behavior of the link when newer versions of the linked asset exists.

Alternatively an AssetLink can also just wrap a Url from which an asset can be loaded directly.

Public Member Functions

MAXON_METHOD const UrlGetUrl () const
 
MAXON_METHOD Result< AssetDescription > Resolve (const AssetRepositoryRef &context) const
 
MAXON_METHOD ASSET_UPDATE_POLICY GetUpdatePolicy () const
 
MAXON_METHOD void SetUpdatePolicy (ASSET_UPDATE_POLICY up)
 

Static Public Member Functions

static MAXON_METHOD Result< AssetLink > Create (const Id &type, const IdAndVersion &aid, ASSET_UPDATE_POLICY up)
 
static MAXON_METHOD Result< AssetLink > Create (const Id &type, const Url &url)
 

Private Member Functions

 MAXON_INTERFACE (AssetLinkInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.interface.assetlink")
 

Private Attributes

 MAXON_INTERFACE_SINGLE_IMPLEMENTATION
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( AssetLinkInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE  ,
"net.maxon.interface.assetlink"   
)
private

◆ Create() [1/2]

static MAXON_METHOD Result<AssetLink> Create ( const Id type,
const IdAndVersion aid,
ASSET_UPDATE_POLICY  up 
)
static

Creates a new AssetLink for the given asset and update policy.

Parameters
[in]typeThe expected type of the asset.
[in]aidIdentifier and version of the asset.
[in]upThe update policy which the created link shall use.
Returns
A new AssetLink.

◆ Create() [2/2]

static MAXON_METHOD Result<AssetLink> Create ( const Id type,
const Url url 
)
static

Creates a new AssetLink for the given Url. This is for assets which aren't stored in a repository, but shall be read directly from a Url such as a local image file.

Parameters
[in]typeThe expected type of the asset.
[in]urlThe Url where the asset can be read from.
Returns
A new AssetLink.

◆ GetUrl()

MAXON_METHOD const Url& GetUrl ( ) const

Returns the Url for a Url-based AssetLink.

Returns
The Url to which this AssetLink points, or a default value when this AssetLink uses an asset identifier instead of a Url.

◆ Resolve()

MAXON_METHOD Result<AssetDescription> Resolve ( const AssetRepositoryRef &  context) const

Resolves this AssetLink to an AssetDescription in the given context. The asset identifier of this link is used to find the asset in context, and if this link uses the policy ASSET_UPDATE_POLICY::IMPLICIT the latest version of the asset is used, otherwise the version recorded in this link.

Parameters
[in]contextThe repository to use for the asset lookup.
Returns
The found AssetDescription or a default value when no asset could be found.

◆ GetUpdatePolicy()

MAXON_METHOD ASSET_UPDATE_POLICY GetUpdatePolicy ( ) const

Returns the update policy which this link uses.

Returns
The update policy of this link.

◆ SetUpdatePolicy()

MAXON_METHOD void SetUpdatePolicy ( ASSET_UPDATE_POLICY  up)

Sets the update policy for this link.

Parameters
[in]upThe new update policy for this link.

Member Data Documentation

◆ MAXON_INTERFACE_SINGLE_IMPLEMENTATION

MAXON_INTERFACE_SINGLE_IMPLEMENTATION
private