Open 3D Engine AzToolsFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzToolsFramework::IMetadataRequests Struct Referenceabstract

Public Member Functions

 AZ_RTTI (IMetadataRequests, "{88EB4C71-F2A5-48C6-A08B-0D6A8EB08A74}")
 
virtual AZ::Outcome< bool, AZStd::string > GetValue (AZ::IO::PathView file, AZStd::string_view key, void *outValue, AZ::Uuid typeId)=0
 
template<typename T >
AZ::Outcome< bool, AZStd::string > GetValue (AZ::IO::PathView file, AZStd::string_view key, T &outValue)
 
virtual AZ::Outcome< bool, AZStd::string > GetJson (AZ::IO::PathView file, AZStd::string_view key, rapidjson::Document &outValue)=0
 
virtual AZ::Outcome< bool, AZStd::string > GetValueVersion (AZ::IO::PathView file, AZStd::string_view key, int &version)=0
 
virtual AZ::Outcome< void, AZStd::string > SetValue (AZ::IO::PathView file, AZStd::string_view key, const void *inValue, AZ::Uuid typeId)=0
 
template<typename T >
AZ::Outcome< void, AZStd::string > SetValue (AZ::IO::PathView file, AZStd::string_view key, const T &inValue)
 

Member Function Documentation

◆ GetJson()

virtual AZ::Outcome< bool, AZStd::string > AzToolsFramework::IMetadataRequests::GetJson ( AZ::IO::PathView  file,
AZStd::string_view  key,
rapidjson::Document &  outValue 
)
pure virtual

Gets the raw JSON from the metadata file associated with the file for the given key. Prefer to use GetValue instead where possible. This is best used for reading old versions.

Parameters
fileAbsolute path to the file (or metadata file).
keyJSONPath formatted key for the metadata value to read. Ex: /Settings/Platform/pc.
Returns
True if metadata file and key exists and was successfully read, false otherwise.

◆ GetValue() [1/2]

template<typename T >
AZ::Outcome< bool, AZStd::string > AzToolsFramework::IMetadataRequests::GetValue ( AZ::IO::PathView  file,
AZStd::string_view  key,
T &  outValue 
)
inline

Gets a value from the metadata file associated with the file for the given key.

Parameters
fileAbsolute path to the file (or metadata file).
keyJSONPath formatted key for the metadata value to read. Ex: /Settings/Platform/pc.
Returns
True if metadata file and key exists and was successfully read, false otherwise.

◆ GetValue() [2/2]

virtual AZ::Outcome< bool, AZStd::string > AzToolsFramework::IMetadataRequests::GetValue ( AZ::IO::PathView  file,
AZStd::string_view  key,
void *  outValue,
AZ::Uuid  typeId 
)
pure virtual

Gets a value from the metadata file associated with the file for the given key.

Parameters
fileAbsolute path to the file (or metadata file).
keyJSONPath formatted key for the metadata value to read. Ex: /Settings/Platform/pc.
typeIdType of the stored value and outValue.
Returns
True if metadata file and key exists and was successfully read, false otherwise.

◆ GetValueVersion()

virtual AZ::Outcome< bool, AZStd::string > AzToolsFramework::IMetadataRequests::GetValueVersion ( AZ::IO::PathView  file,
AZStd::string_view  key,
int &  version 
)
pure virtual

Gets the version for a stored key/value from the metadata file associated with the file.

Parameters
fileAbsolute path to the file (or metadata file).
keyJSONPath formatted key for the metadata value to read. Ex: /Settings/Platform/pc.
Returns
True if metadata file and key exists and was successfully read, false otherwise.

◆ SetValue() [1/2]

template<typename T >
AZ::Outcome< void, AZStd::string > AzToolsFramework::IMetadataRequests::SetValue ( AZ::IO::PathView  file,
AZStd::string_view  key,
const T &  inValue 
)
inline

Sets a value in the metadata file associated with the file.

Parameters
fileAbsolute path to the file (or metadata file).
keyJSONPath formatted key for the metadata value to write. Ex: /Settings/Platform/pc.
Returns
True if the value is successfully saved to disk, false otherwise.

◆ SetValue() [2/2]

virtual AZ::Outcome< void, AZStd::string > AzToolsFramework::IMetadataRequests::SetValue ( AZ::IO::PathView  file,
AZStd::string_view  key,
const void *  inValue,
AZ::Uuid  typeId 
)
pure virtual

Sets a value in the metadata file associated with the file.

Parameters
fileAbsolute path to the file (or metadata file).
keyJSONPath formatted key for the metadata value to write. Ex: /Settings/Platform/pc.
typeIdType of the stored value and inValue.
Returns
True if the value is successfully saved to disk, false otherwise.

The documentation for this struct was generated from the following file: