#include <assets.h>
An AssetType provides the methods needed by an asset repository to handle a specific type of assets. For example there is one asset type for node systems which knows how to load and store node systems and their description resources, one for pure files and so on. Asset types are registered at the AssetTypes registry.
Public Types | |
using | RESTRICT_DICTIONARY_PROPS = ASSETTYPEPROPERTIES::RESTRICT |
Public Member Functions | |
MAXON_METHOD const Id & | GetId () const |
MAXON_METHOD const DataType & | GetAssetDataType () const |
MAXON_METHOD Result< String > | GetUrlSuffix (const Asset &asset) const |
MAXON_METHOD Result< Url > | GetDefaultIcon (const AssetRepositoryRef &repository, const IdAndVersion &asset, const AssetMetaData &meta) const |
MAXON_METHOD Result< Asset > | Load (const AssetRepositoryRef &repo, const AssetDescription &assetDescription, const Url &url, Bool *updateLinks) const |
MAXON_METHOD Result< HashMap< InternedId, Data > > | Store (const Asset &asset, const Url &url, const OutputStreamDecoratorFactory &hashStream) const |
MAXON_METHOD Result< void > | CopyWithEncryption (const AssetDescription &source, const Url &from, const Url &to) const |
MAXON_METHOD Result< DataDescriptionDefinition > | LoadDescriptionDefinition (const AssetDescription &asset, LOADDESCRIPTIONMODE mode, const Id &category, const LanguageRef &language) const |
MAXON_METHOD Result< AssetDescription > | StoreDescriptionDefinition (const AssetDescription &asset, const Id &category, const LanguageRef &language, const DataDescriptionDefinition &overwrittenDescription, const AssetRepositoryRef &storeRepository) const |
MAXON_METHOD Result< Id > | GetRepositoryId (const Id &id, Bool fromTo) const |
MAXON_METHOD Result< String > | GetMetaString (const AssetDescription &asset, const InternedId &key, const LanguageRef &languageRef, const String &fallback) const |
MAXON_METHOD Result< void > | StoreMetaString (const AssetDescription &asset, const InternedId &key, const String &value, const LanguageRef &languageRef) const |
MAXON_METHOD Result< Tuple< Data, Bool > > | ComputeMetaData (const AssetRepositoryRef &repository, const IdAndVersion &asset, const AssetMetaData &meta, const InternedId &metaId) const |
Private Member Functions | |
MAXON_INTERFACE (AssetTypeInterface, MAXON_REFERENCE_CONST, "net.maxon.interface.assettype") | |
using RESTRICT_DICTIONARY_PROPS = ASSETTYPEPROPERTIES::RESTRICT |
|
private |
MAXON_METHOD const Id& GetId | ( | ) | const |
Returns the identifier of this asset type. This has to be the same as used for the AssetTypes registry.
MAXON_METHOD const DataType& GetAssetDataType | ( | ) | const |
MAXON_METHOD Result<String> GetUrlSuffix | ( | const Asset & | asset | ) | const |
MAXON_METHOD Result<Url> GetDefaultIcon | ( | const AssetRepositoryRef & | repository, |
const IdAndVersion & | asset, | ||
const AssetMetaData & | meta | ||
) | const |
GetDefaultIcon returns the default icon of this asset type.
[in] | repository | Repository to search for. |
[in] | asset | Asset id and version. |
[in] | meta | meta data of the asset to store. |
MAXON_METHOD Result<Asset> Load | ( | const AssetRepositoryRef & | repo, |
const AssetDescription & | assetDescription, | ||
const Url & | url, | ||
Bool * | updateLinks | ||
) | const |
Loads an asset from a Url.
[in] | repo | The repository to which the asset belongs. |
[in] | assetDescription | The asset description. |
[in] | url | The Url from which the asset shall be loaded. |
[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_METHOD Result<HashMap<InternedId, Data> > Store | ( | const Asset & | asset, |
const Url & | url, | ||
const OutputStreamDecoratorFactory & | hashStream | ||
) | const |
Stores an asset at the given Url.
[in] | asset | The asset to store, has to match the expected data type of this AssetType. |
[in] | url | The Url where to store the asset. |
[in] | hashStream | The stream decorator to use for each created output stream. This can be used by the caller to compute a hash value of the asset content which is then used as version identifier. |
MAXON_METHOD Result<void> CopyWithEncryption | ( | const AssetDescription & | source, |
const Url & | from, | ||
const Url & | to | ||
) | const |
CopyWithEncryption copies the asset with encryption to the new url.
[in] | source | Asset to copy. |
[in] | from | source url. |
[in] | to | destination url. |
MAXON_METHOD Result<DataDescriptionDefinition> LoadDescriptionDefinition | ( | const AssetDescription & | asset, |
LOADDESCRIPTIONMODE | mode, | ||
const Id & | category, | ||
const LanguageRef & | language | ||
) | const |
LoadDescriptionDefinition loads the data description of the given asset.
[in] | asset | Asset to load. |
[in] | mode | see LOADDESCRIPTIONMODE. |
[in] | category | DATADESCRIPTION_CATEGORY_xxx |
[in] | language | Language id in case of DATADESCRIPTION_CATEGORY_STRING. |
MAXON_METHOD Result<AssetDescription> StoreDescriptionDefinition | ( | const AssetDescription & | asset, |
const Id & | category, | ||
const LanguageRef & | language, | ||
const DataDescriptionDefinition & | overwrittenDescription, | ||
const AssetRepositoryRef & | storeRepository | ||
) | const |
StoreDescriptionDefinition description.
[in] | asset | Asset to store. |
[in] | category | DATADESCRIPTION_CATEGORY_xxx |
[in] | language | Language id in case of DATADESCRIPTION_CATEGORY_STRING. |
[in] | overwrittenDescription | Additional description with overwritten parameters. |
[in] | storeRepository | Repository to store the asset. |
MAXON_METHOD Result<Id> GetRepositoryId | ( | const Id & | id, |
Bool | fromTo | ||
) | const |
GetRepositoryId returns the default id of the asset.
[in] | id | Id of the asset. |
[in] | fromTo | True to add the full id. False to cut the hash code and append it. |
MAXON_METHOD Result<String> GetMetaString | ( | const AssetDescription & | asset, |
const InternedId & | key, | ||
const LanguageRef & | languageRef, | ||
const String & | fallback | ||
) | const |
GetMetaString returns the translated string from a asset.
[in] | asset | Asset to load. |
[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 AssetDescription & | asset, |
const InternedId & | key, | ||
const String & | value, | ||
const LanguageRef & | languageRef | ||
) | const |
StoreMetaString stores the name of an asset for a language.
[in] | asset | Asset to modify. |
[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. |
MAXON_METHOD Result<Tuple<Data, Bool> > ComputeMetaData | ( | const AssetRepositoryRef & | repository, |
const IdAndVersion & | asset, | ||
const AssetMetaData & | meta, | ||
const InternedId & | metaId | ||
) | const |
Overload ComputeMetaData to specialize the loading of meta data.
[in] | repository | Resository where the asset is stored. |
[in] | asset | Asset id and version. |
[in] | meta | Meta data of the asset. |
[in] | metaId | MetaId to load. |