#include <assets.h>
An AssetDescription represents all meta information about an asset, namely its identifer and version, the AssetMetaData and some further information. AssetRepositoryInterface::FindAssets yields the found assets not as Asset, but as AssetDescription to avoid unnecessary loading of the assets. When you really need the asset itself you have to call Load on the description.
Public Member Functions | |
MAXON_METHOD Result< const Url & > | GetUrl () const |
MAXON_METHOD Result< Asset > | Load (Bool *updateLinks) const |
MAXON_FUNCTION Result< Asset > | Load () const |
MAXON_METHOD const AssetMetaData & | GetMetaData () const |
MAXON_METHOD Bool | IsDeleted () const |
MAXON_FUNCTION Result< void > | StoreMetaData (const InternedId &attr, ForwardingDataPtr &&data, AssetMetaDataInterface::KIND kind) const |
template<typename ATTR > | |
MAXON_FUNCTION Result< void > | StoreMetaData (const ATTR &attr, typename ATTR::ValueType &&data, AssetMetaDataInterface::KIND kind) const |
template<typename ATTR > | |
MAXON_FUNCTION Result< void > | StoreMetaData (const ATTR &attr, const typename ATTR::ValueType &data, AssetMetaDataInterface::KIND kind) const |
template<typename ATTR > | |
MAXON_FUNCTION Result< void > | EraseMetaData (const ATTR &attr, AssetMetaDataInterface::KIND kind) const |
MAXON_FUNCTION Result< void > | StoreUrlMetaData (const InternedId &metaId, const Url &source, AssetMetaDataInterface::KIND kind) const |
MAXON_METHOD Result< String > | GetMetaString (const InternedId &key, const LanguageRef &languageRef=GetPtrSizedZeroRef< LanguageRef >(), const String &fallback=GetPtrSizedZeroRef< String >()) const |
MAXON_METHOD Result< void > | StoreMetaString (const InternedId &key, const String &value, const LanguageRef &languageRef) const |
Private Member Functions | |
MAXON_INTERFACE (AssetDescriptionInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.interface.assetdescription") | |
|
private |
MAXON_METHOD Result<const Url&> GetUrl | ( | ) | const |
MAXON_METHOD Result<Asset> Load | ( | Bool * | updateLinks | ) | const |
Loads the asset. The implementation may use caching to avoid repeated loading of the same asset.
[in,out] | updateLinks | nullptr if the asset shall be loaded as is, or a pointer to a Bool if asset links which use ASSET_UPDATE_POLICY::IMPLICIT shall be resolved to the latest version. The Bool is set to true by this method whenever there is a link where the resolved version differs from the original version. |
MAXON_FUNCTION Result<Asset> Load | ( | ) | const |
Loads the asset, thereby updating asset links which use ASSET_UPDATE_POLICY::IMPLICIT to the latest version. The implementation may use caching to avoid repeated loading of the same asset.
MAXON_METHOD const AssetMetaData& GetMetaData | ( | ) | const |
Returns the meta data of this asset.
MAXON_METHOD Bool IsDeleted | ( | ) | const |
Returns true if this asset description is a delete marker. Delete markers are stored in repositories upon call of AssetRepositoryInterface::DeleteAsset to indicate a deleted asset, but previous asset versions still exist in the repository.
MAXON_FUNCTION Result<void> StoreMetaData | ( | const InternedId & | attr, |
ForwardingDataPtr && | data, | ||
AssetMetaDataInterface::KIND | kind | ||
) | const |
Stores #data for the meta data attribute #attr of this asset. Observers of AssetRepositoryInterface::ObservableMetaDataStored of the repository of the asset and its derived repositories are informed.
[in] | attr | The meta data attribute. |
[in] | data | The value to set. |
[in] | kind | The kind of the meta data. |
MAXON_FUNCTION Result<void> StoreMetaData | ( | const ATTR & | attr, |
typename ATTR::ValueType && | data, | ||
AssetMetaDataInterface::KIND | kind | ||
) | const |
Stores #data for the meta data attribute #attr of this asset. Observers of AssetRepositoryInterface::ObservableMetaDataStored of the repository of the asset and its derived repositories are informed.
[in] | attr | The meta data attribute. |
[in] | data | The value to set. |
[in] | kind | The kind of the meta data. |
MAXON_FUNCTION Result<void> StoreMetaData | ( | const ATTR & | attr, |
const typename ATTR::ValueType & | data, | ||
AssetMetaDataInterface::KIND | kind | ||
) | const |
Stores #data for the meta data attribute #attr of this asset. Observers of AssetRepositoryInterface::ObservableMetaDataStored of the repository of the asset and its derived repositories are informed.
[in] | attr | The meta data attribute. |
[in] | data | The value to set. |
[in] | kind | The kind of the meta data. |
MAXON_FUNCTION Result<void> EraseMetaData | ( | const ATTR & | attr, |
AssetMetaDataInterface::KIND | kind | ||
) | const |
EraseMetaData removes meta data from the asset.
[in] | attr | The meta data attribute. |
[in] | kind | The kind of the meta data. |
MAXON_FUNCTION Result<void> StoreUrlMetaData | ( | const InternedId & | metaId, |
const Url & | source, | ||
AssetMetaDataInterface::KIND | kind | ||
) | const |
Copies the file or directory source as meta data for the meta data attribute #metaId of this #asset. The value of the meta data attribute will be a Url which points to the local copy within the asset (i.e., not to source) of the form {meta:///assetid/metaid.kind.extension}, so the file name extension of source gets preserved. Observers of ObservableMetaDataStored of this repository and its derived repositories are informed.
[in] | metaId | The identifier of the meta data attribute. |
[in] | source | The source which shall be copied as meta data to #asset. Pass empty Url to erase meta data. |
[in] | kind | The kind of the meta data. |
MAXON_METHOD Result<String> GetMetaString | ( | const InternedId & | key, |
const LanguageRef & | languageRef = GetPtrSizedZeroRef< LanguageRef >() , |
||
const String & | fallback = GetPtrSizedZeroRef< String >() |
||
) | const |
GetMetaString returns the translated string from a asset.
[in] | key | Attribute id to load. e.g. OBJECT::BASE:NAME. |
[in] | languageRef | Optional language. By default the function uses the current language. |
[in] | fallback | Fallback string if the asset has no name. |
MAXON_METHOD Result<void> StoreMetaString | ( | const InternedId & | key, |
const String & | value, | ||
const LanguageRef & | languageRef | ||
) | const |
StoreMetaString stores the name of an asset for a language.
[in] | key | Attribute id to save. e.g. OBJECT::BASE:NAME. |
[in] | value | New string. |
[in] | languageRef | Optional language. By default the function uses the current language. |