|
|
| Conf (Json data) |
| |
|
| Conf (std::string file) |
| |
|
| Conf (Json data, std::string file) |
| |
|
| Conf (Json data, std::string file, std::string root) |
| |
| bool | is_from_file () const |
| |
| const std::string & | file () const |
| |
| bool | is_empty () const |
| |
| const Json & | operator* () const |
| |
|
Json & | operator* () |
| |
| const Json * | operator-> () const |
| |
|
Json * | operator-> () |
| |
| std::string | root () const |
| |
| bool | has (const std::string &key) const |
| |
|
bool | has (const JsonPointer &key) const |
| |
|
bool | has_pointer (const std::string &key) const |
| |
| Conf | at (const std::string &key) const |
| |
|
Conf | at (const JsonPointer &key) const |
| |
|
Conf | at_pointer (const std::string &key) const |
| |
| size_t | erase (const std::string &key) |
| |
|
size_t | erase (const JsonPointer &key) |
| |
|
size_t | erase_pointer (const std::string &key) |
| |
| std::vector< Conf > | to_array () const |
| |
| template<typename T > |
| T | get () const |
| |
| template<typename T > |
| T | get (const std::string &key) const |
| |
|
template<typename T > |
| T | get (const JsonPointer &key) const |
| |
|
template<typename T > |
| T | get_pointer (const std::string &key) const |
| |
| template<typename T > |
| T | get_or (const std::string &key, T def) const |
| |
|
template<typename T > |
| T | get_or (const JsonPointer &key, T def) const |
| |
|
template<typename T > |
| T | get_pointer_or (const std::string &key, T def) const |
| |
| template<typename T > |
| void | with (const std::string &key, std::function< void(const T &)> fn) const |
| |
|
template<typename T > |
| void | with (const JsonPointer &key, std::function< void(const T &)> fn) const |
| |
|
template<typename T > |
| void | with_pointer (const std::string &key, std::function< void(const T &)> fn) const |
| |
| template<typename T > |
| void | try_from (const std::string &key, T &val) const |
| |
|
template<typename T > |
| void | try_from (const JsonPointer &key, T &val) const |
| |
|
template<typename T > |
| void | try_from_pointer (const std::string &key, T &val) const |
| |
| void | assert_has (const std::string &key) const |
| |
|
void | assert_has (const JsonPointer &key) const |
| |
|
void | assert_has_pointer (const std::string &key) const |
| |
| void | assert_has_type (const std::string &key, JsonType t) const |
| |
|
void | assert_has_type (const JsonPointer &key, JsonType t) const |
| |
|
void | assert_has_pointer_type (const std::string &key, JsonType t) const |
| |
| void | assert_has_not (const std::string &key, const std::string &msg="") const |
| |
|
void | assert_has_not (const JsonPointer &key, const std::string &msg="") const |
| |
|
void | assert_has_pointer_not (const std::string &key, const std::string &msg="") const |
| |
| std::filesystem::path | resolve_file (const std::filesystem::path &filename) const |
| |
|
std::string | resolve_file (const std::string &filename) const |
| |
|
template<typename... Args> |
| void | throw_error (std::string_view format, Args &&... args) const |
| |
|
void | throw_error (const std::string &msg) const |
| |
|
void | throw_unexpected (const std::string &key, const std::string &msg="") const |
| |
|
void | throw_missing (const std::string &key) const |
| |
|
void | throw_wrong_type (const std::string &key="") const |
| |
|
void | throw_wrong_type (const std::string &key, JsonType type) const |
| |
Conf wraps a JSON with context that allows for more user-friendly errors.
In general, a Conf wraps JSON content that comes from the filesystem and is used for configuration purposes. Even if a class requires only a subset of the JSON, Conf maintains the connection to the original file, which allows errors to be returned that refer to the file and location.
Conf is best used together with the Confable and Schema types.