|
VoltMod
C++23 framework for CS2 server plugins
|
Owns a plugin's settings and republishes them whole on every Load. More...
#include <Options.hpp>
Public Types | |
| using | Builder = std::function< TSnapshot(TSettings)> |
| Validates the parsed settings and derives whatever Get() offers beside them. | |
Public Member Functions | |
| Options () | |
| Options (Builder build) | |
| Status | Load (std::string_view path) |
Load path (JSONC tolerated), build the snapshot, then publish it in one move. | |
| Status | Reload () |
| const TSnapshot & | Get () const |
Owns a plugin's settings and republishes them whole on every Load.
TSettings is a plain aggregate whose member names are the JSON keys. A missing key keeps the member's initializer and unknown keys are ignored. To validate or derive values, name a TSnapshot and pass the function that builds it from the parsed settings. The snapshot is built before it is published, so a failed Load keeps the previous one. See docs/config.md.
Definition at line 24 of file Options.hpp.
Validates the parsed settings and derives whatever Get() offers beside them.
Definition at line 28 of file Options.hpp.
|
inline |
Publishes the parsed settings unchanged.
Definition at line 31 of file Options.hpp.
|
inlineexplicit |
Definition at line 36 of file Options.hpp.
|
inline |
The effective settings.
Definition at line 68 of file Options.hpp.
|
inline |
Load path (JSONC tolerated), build the snapshot, then publish it in one move.
On failure the previously published snapshot stands, and the error names the offending key with its line and column.
Definition at line 42 of file Options.hpp.
References VoltMod::Log::Info(), VoltMod::ReadFile(), and VoltMod::Json::ReadFile().
Referenced by VoltMod::Options< TSettings, TSnapshot >::Reload().
|
inline |
Load the path the last Load read, again.
Definition at line 58 of file Options.hpp.
References VoltMod::Options< TSettings, TSnapshot >::Load(), and VoltMod::Error::NotReady().