Open 3D Engine AzFramework 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.
AZ::DocumentPropertyEditor::SettingsRegistrar Class Reference

#include <SettingsRegistrar.h>

Public Member Functions

AZ::Outcome< void, AZStd::string > SaveSettingsToFile (AZ::IO::PathView relativeFilepath, AZ::SettingsRegistryMergeUtils::DumperSettings dumperSettings, const AZStd::string &anchorKey={}, AZ::SettingsRegistryInterface *registry=nullptr) const
 
AZ::Outcome< bool, AZStd::string > LoadSettingsFromFile (AZ::IO::PathView relativeFilepath, AZStd::string_view anchorKey={}, AZ::SettingsRegistryInterface *registry=nullptr, AZ::SettingsRegistryInterface::Format format=AZ::SettingsRegistryInterface::Format::JsonMergePatch) const
 
template<typename AzRttiEnabled_T >
AZ::Outcome< bool, AZStd::string > GetObjectSettings (AzRttiEnabled_T *outSettingsObject, AZStd::string_view registryPath, AZ::SettingsRegistryInterface *registry=nullptr) const
 
template<typename AzRttiEnabled_T >
AZ::Outcome< void, AZStd::string > StoreObjectSettings (AZStd::string_view registryPath, AzRttiEnabled_T *settingsObject, AZ::SettingsRegistryInterface *registry=nullptr) const
 Attempts to store reflected properties of the given AZ_RTTI enabled object at the given registry path.
 
bool RemoveSettingFromRegistry (AZStd::string_view registryPath, AZ::SettingsRegistryInterface *registry=nullptr) const
 

Static Public Attributes

static constexpr const char * SettingsRegistryFileExt = AZ::SettingsRegistryInterface::Extension
 The file extension expected for SettingsRegistry files.
 

Detailed Description

Class wrapping file management required to save SettingsRegistry data to file as well as load json data from file to the SettingsRegistry.

Member Function Documentation

◆ GetObjectSettings()

template<typename AzRttiEnabled_T >
AZ::Outcome< bool, AZStd::string > AZ::DocumentPropertyEditor::SettingsRegistrar::GetObjectSettings ( AzRttiEnabled_T *  outSettingsObject,
AZStd::string_view  registryPath,
AZ::SettingsRegistryInterface *  registry = nullptr 
) const
inline

Attempts to retrieve settings stored at the given registry path and put them in the provided object. The provided object is expected to be intialized before being passed to this function and it must be AZ_RTTI enabled. Succeeds if the given entry was read or if it does not exist. Upon success, returns whether the given settings entry exists or not.

◆ LoadSettingsFromFile()

AZ::Outcome< bool, AZStd::string > AZ::DocumentPropertyEditor::SettingsRegistrar::LoadSettingsFromFile ( AZ::IO::PathView  relativeFilepath,
AZStd::string_view  anchorKey = {},
AZ::SettingsRegistryInterface *  registry = nullptr,
AZ::SettingsRegistryInterface::Format  format = AZ::SettingsRegistryInterface::Format::JsonMergePatch 
) const

Loads settings from the provided '.setreg' file and merges settings into the SettingsRegistry at the given anchor key. The path passed to this function is expected to be relative to the project root. Succeeds if the file was loaded or if the file does not exist. Upon success, returns whether the file exists or not.

◆ SaveSettingsToFile()

AZ::Outcome< void, AZStd::string > AZ::DocumentPropertyEditor::SettingsRegistrar::SaveSettingsToFile ( AZ::IO::PathView  relativeFilepath,
AZ::SettingsRegistryMergeUtils::DumperSettings  dumperSettings,
const AZStd::string &  anchorKey = {},
AZ::SettingsRegistryInterface *  registry = nullptr 
) const

Saves all settings stored at the given SettingsRegistry key into a file at the given filepath. The file and directory structure will be created if it does now exist. The file open mode is set to overwrite existing file contents. The path passed to this function is expected to be relative to the project root. The DumperSettings can be used to narrow down the settings data dumped to file by providing an filter function. Specifying a json pointer path prefix in the DumperSettings may be required in order for the dumped json data to match the in-memory path structure. The anchor key specifies a path in the registry where the settings will be saved.


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