cubos::engine::AssetMeta class final

Stores metadata about an asset - the data stored in .meta files. Each asset has a corresponding meta object, which contains load or import parameters.

Serialization:

  • can be serialized and deserialized without context.
  • when serialized with the type AssetMeta::Exclude in the context, the specified keys are excluded from the serialization.

Public types

struct Exclude
Used as context to exclude parameters from being serialized.

Public functions

auto get(std::string_view key) const -> std::optional<std::string>
Gets the value of a parameter on the asset's metadata.
void set(std::string_view key, std::string_view value)
Sets a parameter on the asset's metadata.
void remove(std::string_view key)
Removes a parameter from the asset's metadata.
auto params() const -> const std::unordered_map<std::string, std::string>&
Gets the parameters of the asset's metadata.
auto params() -> std::unordered_map<std::string, std::string>&
Gets the parameters of the asset's metadata.

Function documentation

std::optional<std::string> cubos::engine::AssetMeta::get(std::string_view key) const

Gets the value of a parameter on the asset's metadata.

Parameters
key Key of the parameter.
Returns The value of the parameter, if the parameter exists.

void cubos::engine::AssetMeta::set(std::string_view key, std::string_view value)

Sets a parameter on the asset's metadata.

Parameters
key Key of the parameter.
value Value of the parameter.

void cubos::engine::AssetMeta::remove(std::string_view key)

Removes a parameter from the asset's metadata.

Parameters
key Key of the parameter.

const std::unordered_map<std::string, std::string>& cubos::engine::AssetMeta::params() const

Gets the parameters of the asset's metadata.

Returns Parameters of the asset.

std::unordered_map<std::string, std::string>& cubos::engine::AssetMeta::params()

Gets the parameters of the asset's metadata.

Returns Parameters of the asset.