|
CppZmqZoltanExt 0.0.1
|
ZPL configuration tree loaded from text or file. More...
#include <zpl_config.h>
Classes | |
| struct | impl_t |
Public Member Functions | |
| zpl_config_t () noexcept | |
| Construct an empty configuration. | |
| zpl_config_t (std::istream &input) | |
| Construct and parse a configuration from a stream. | |
| void | load (std::istream &input) |
| Load configuration data from a stream. | |
| void | load_from_file (const std::string &file_path) |
| Load configuration data from a file. | |
| bool | empty () const noexcept |
| Check whether the configuration is empty. | |
| const std::string & | name () const noexcept |
| Get the node name. | |
| const std::string & | value () const noexcept |
| Get the node value. | |
| bool | contains (const std::string &path) const noexcept |
| Check if a path exists. | |
| const std::string & | get (const std::string &path) const |
| Get a property value by path. | |
| std::optional< std::string > | try_get (const std::string &path) const noexcept |
| Try to get a property value by path. | |
| std::string | get_or (const std::string &path, std::string default_value) const noexcept |
| Get a property value or return a default. | |
| zpl_config_t | child (const std::string &path) const |
| Get a child node by path. | |
| std::optional< zpl_config_t > | try_child (const std::string &path) const noexcept |
| Try to get a child node by path. | |
| std::vector< zpl_config_t > | children () const noexcept |
| Get direct children of this node. | |
Static Public Member Functions | |
| static zpl_config_t | from_stream (std::istream &input) |
| Parse and return a configuration from a stream. | |
| static zpl_config_t | from_file (const std::string &file_path) |
| Parse and return a configuration from a file. | |
ZPL configuration tree loaded from text or file.
The zpl_config_t class provides a read-only view over a parsed ZPL (ZeroMQ Property Language) configuration. Each instance represents a node in the configuration tree. Nodes expose their name and value, and can be queried for children by path.
Paths are expressed in ZPL relative/path/to/property notation (e.g. "child/key") relative to the current configuration node. A property in the tree can be accessed by its full path from the root or by navigating through all path segments. Query methods throw when a path is invalid or missing, while try_* variants return empty optionals or defaults.
Definition at line 137 of file zpl_config.h.
|
noexcept |
Construct an empty configuration.
Definition at line 374 of file zpl_config.cpp.
|
explicit |
Construct and parse a configuration from a stream.
| input | Input stream containing ZPL text |
| zpl_parse_error | on parse errors |
| std::ios_base::failure | if any error during input reading occurs |
Definition at line 378 of file zpl_config.cpp.
| zpl_config_t zmqzext::zpl_config_t::child | ( | const std::string & | path | ) | const |
Get a child node by path.
| path | ZPL path to a property relative to this node |
| zpl_property_not_found | if the path does not exist |
Definition at line 446 of file zpl_config.cpp.
|
noexcept |
Get direct children of this node.
Definition at line 468 of file zpl_config.cpp.
|
noexcept |
Check if a path exists.
| path | ZPL path to a property relative to this node |
Definition at line 418 of file zpl_config.cpp.
|
noexcept |
Check whether the configuration is empty.
Definition at line 402 of file zpl_config.cpp.
|
static |
Parse and return a configuration from a file.
| file_path | Path to the ZPL file |
| zpl_parse_error | on parse errors |
| std::ios_base::failure | if the path is invalid or any error during file reading occurs |
Definition at line 386 of file zpl_config.cpp.
|
static |
Parse and return a configuration from a stream.
| input | Input stream containing ZPL text |
| zpl_parse_error | on parse errors |
| std::ios_base::failure | if any error during input reading occurs |
Definition at line 380 of file zpl_config.cpp.
| const std::string & zmqzext::zpl_config_t::get | ( | const std::string & | path | ) | const |
Get a property value by path.
| path | ZPL path to a property relative to this node |
| zpl_property_not_found | if the path does not exist |
Definition at line 422 of file zpl_config.cpp.
|
noexcept |
Get a property value or return a default.
| path | ZPL path to a property relative to this node |
| default_value | Value returned when the property is not found |
Definition at line 438 of file zpl_config.cpp.
| void zmqzext::zpl_config_t::load | ( | std::istream & | input | ) |
Load configuration data from a stream.
Replaces the current configuration with the parsed content.
| input | Input stream containing ZPL text |
| zpl_parse_error | on parse errors |
| std::ios_base::failure | if any error during input reading occurs |
Definition at line 392 of file zpl_config.cpp.
| void zmqzext::zpl_config_t::load_from_file | ( | const std::string & | file_path | ) |
Load configuration data from a file.
Replaces the current configuration with the parsed content.
| file_path | Path to the ZPL file |
| zpl_parse_error | on parse errors |
| std::ios_base::failure | if the path is invalid or any error during file reading occurs |
Definition at line 394 of file zpl_config.cpp.
|
noexcept |
|
noexcept |
Try to get a child node by path.
| path | ZPL path to a property relative to this node |
Definition at line 457 of file zpl_config.cpp.
|
noexcept |
Try to get a property value by path.
| path | ZPL path to a property relative to this node |
Definition at line 430 of file zpl_config.cpp.
|
noexcept |