Class ConfigFile

Class Documentation

class ConfigFile

Utility to locate and monitor a configuration file via the XDG Base Directory Specification.

Vis: ($XDG_CONFIG_HOME or $HOME/.config followed by $XDG_CONFIG_DIRS). If, instead of a filename, a path is given, then the base directories are not applied.

If mode is no_reloading, then the file is loaded on startup and not reloaded

If mode is reload_on_change, then the file is loaded on startup and either the user-specific configuration file base ($XDG_CONFIG_HOME or $HOME/.config), or the supplied path is monitored for changes.

Remark

MirAL 5.1

Public Types

enum class Mode

Mode of reloading.

Values:

enumerator no_reloading
enumerator reload_on_change
using Loader = std::function<void(std::istream &istream, std::filesystem::path const &path)>

Loader functor is passed both the open stream and the actual path (for use in reporting problems)

Public Functions

ConfigFile(MirRunner &runner, std::filesystem::path file, Mode mode, Loader load_config)
~ConfigFile()