CppZmqZoltanExt 0.0.1
Loading...
Searching...
No Matches
zpl_config.h File Reference

ZPL (ZeroMQ Property Language) parser. More...

#include <cstddef>
#include <istream>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>
#include <vector>
#include "cppzmqzoltanext/czze_export.h"
Include dependency graph for zpl_config.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  zmqzext::zpl_error
 Base exception for ZPL configuration errors. More...
 
class  zmqzext::zpl_parse_error
 Exception thrown when a badly formatted ZPL input is encountered during parsing. More...
 
class  zmqzext::zpl_property_not_found
 Exception thrown when a requested property is missing. More...
 
class  zmqzext::zpl_config_t
 ZPL configuration tree loaded from text or file. More...
 

Detailed Description

ZPL (ZeroMQ Property Language) parser.

This header provides the zpl_config_t class for parsing and navigating ZPL configuration files (https://rfc.zeromq.org/spec/4/). The parser builds a hierarchical tree of properties, preserving the original order of siblings for stable iteration.

ZPL file structure:

  • Each non-empty line defines a property name with an optional value separated by a equals sign ('=').
  • Whitespace before a name defines indentation level (4 spaces per level).
  • Child properties are indented exactly one level deeper than their parent.
  • A line starting with '#' is a comment and is ignored.
  • Inline comments are allowed after a name or value and start with '#'.
  • Values are untyped strings; quoted values may use single or double quotes.
  • Quotes are not escaped; a missing closing quote is a parse error.
  • Property names may include '/', which is treated as a path separator.

Class rules and behavior:

  • Parsing builds a tree of nodes with name, value, and ordered children.
  • Lookup paths are relative to the current node; a leading '/' is ignored.
  • Throwing lookup functions signal missing properties or invalid paths.
  • try_* functions return empty optionals instead of throwing.
  • children() returns direct children in source order.

Error model:

  • zpl_parse_error for syntax/structure violations (with line number).
  • zpl_property_not_found for missing properties on throwing lookups.
  • std::ios_base::failure for stream or file read failures.
Authors
Luan Young (luanp.nosp@m.y@gm.nosp@m.ail.c.nosp@m.om)

Distributed under the MIT License (MIT) (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)

Definition in file zpl_config.h.