|
template<IsSetting S>
requires (Schema::template has_setting<S>) |
| auto | Get () const -> typename S::value_type |
| | Gets the value for a setting type.
|
| |
template<IsSetting S>
requires (Schema::template has_setting<S>) |
| auto | Set (typename S::value_type value) -> Status |
| | Sets the value for a setting type.
|
| |
| auto | Load () -> Status |
| | Loads configuration from the file.
|
| |
| auto | Save () const -> Status |
| | Saves the current configuration to the file.
|
| |
| auto | Diff () const -> ConfigDiff |
| | Returns the diff between file values and defaults.
|
| |
| auto | ValidateAll () const -> Status |
| | Validates all current values against their validators.
|
| |
| auto | GetFilePath () const -> std::string_view |
| | Returns the file path.
|
| |
template<typename Derived, typename Schema>
class cppfig::IConfigurationProvider< Derived, Schema >
CRTP base class for configuration providers.
This class defines the interface that all configuration providers must implement. It uses CRTP to allow compile-time polymorphism while still being compatible with GMock for testing.
- Template Parameters
-
| Derived | The derived configuration provider class. |
| Schema | The ConfigSchema type. |
template<typename Derived , typename Schema >
template<IsSetting S>
requires (Schema::template has_setting<S>)
Sets the value for a setting type.
The value is validated before being set. Returns an error if validation fails.
Usage: config.Set<MySettings::ServerPort>(8080)