carb::settings::loadSettingsFromFile

Defined in carb/settings/SettingsUtils.h

inline void carb::settings::loadSettingsFromFile(ISettings *settings, const char *path, dictionary::IDictionary *dictionary, dictionary::ISerializer *serializer, const char *filename)

A helper function to load settings from a file.

This function first creates a dictionary from a file using the provided serializer passed to carb::dictionary::createDictionaryFromFile(). The dictionary is then applied to the settings system with ISettings::update at settings path path using the carb::dictionary::overwriteOriginalWithArrayHandling() method. The created dictionary is then destroyed. When the function returns, the settings from the given filename are available to be queried through the settings system.

Parameters
  • settings – The acquired ISettings interface.

  • path – The path at which the loaded settings are placed. An empty string or “/” is considered the root of the settings tree.

  • dictionary – The acquired dictionary::IDictionary interface.

  • serializer – The dictionary::ISerializer interface to use. The file format should match the format of filename. I.e. if filename is a json file, the dictionary::ISerializer from carb.dictionary.serializer-json.plugin should be used.

  • filename – The filename to read settings from.