This repository is StormByte Config: human-readable text and versioned binary documents for the StormByte C++ suite.
It depends on StormByte Base ≥ 2.0.0 and StormByte String ≥ 1.0.0. Public headers live under StormByte/config/ and cover the document, items (values, comments, groups, lists), Save / Load, and collision / hook policy.
The suite is split on purpose. Base, Buffer, Crypto, Database, Logger, Multimedia, Network and System are other repositories. This one does not implement them.
Save / Load with Mode::Text or Mode::Binary on any std::ostream / std::istream. Stream operators stay text-only.STBTCF + format version. Older layouts load; newer ones are rejected; save always writes the current version.Item::Value (text, integer, double, boolean, StormByte::BinaryData). Access is Base::As<T>(). Text binary form is Base64 b"..."; the binary document stores raw bytes.#, //, /* */.[] and groups {}. Counts and indices use StormByte::Size.AddHookBeforeRead / AddHookAfterRead / OnParseFailure. Stateless hooks are function pointers. Stateful hooks derive from ReadHook / FailureHook and are built with MakePointer.Keep, Overwrite, or ThrowException (default).Clonable<Base, Shared<Base>>. Build them with MakePointer when you hold PointerType.| Module | Role | API |
|---|---|---|
| Base | Exceptions, Expected, serialization, strings, UUID, concepts | /StormByte |
| Buffer | FIFO, SharedFIFO, Ring, Producer/Consumer and multi-stage pipelines | /StormByte-Buffer |
| Config | This repository | /StormByte-Config |
| Crypto | Hash, compress, encrypt, sign and key agreement — Crypto++ never leaves the private tree | /StormByte-Crypto |
| Database | One API over SQLite, PostgreSQL and MariaDB | /StormByte-Database |
| Logger | Stream logger with levels, headers, human-readable sizes and redaction (ThreadedLog) | /StormByte-Logger |
| Multimedia | Decode, encode and containers without raw FFmpeg types; codecs enabled only if present | /StormByte-Multimedia |
| Network | Framed packets, Client/Server, IPv4/IPv6 TCP and Buffer pipelines (compress/encrypt) | /StormByte-Network |
| System | Processes, pipes and environment variables across Linux, Windows and macOS | /StormByte-System |
Needs a C++26 compiler, CMake 3.28 or newer, StormByte Base ≥ 2.0.0 and StormByte String ≥ 1.0.0.
Shared vs static follows CMake BUILD_SHARED_LIBS (declared in lib/, default ON). A plain configure builds the shared library. -DBUILD_SHARED_LIBS=OFF builds a static archive; on Windows the headers then do not use dllimport. Vendored StormByte-String (and Base through String) follows the same mode.
A shared build keeps this library as its own .so / .dll. Under the LGPL that is usually the simpler way to ship: the user can replace that file. A static archive is folded into your binary. The LGPL still applies to this code; you must give the recipient a way to relink your product with a different build of this library. If that does not fit how you distribute the final product, a commercial license is available from the copyright holder (see License).
Link StormByte-Config (and String / Base). Include path: the public install prefix, headers as #include <StormByte/config/….hxx>.
Headers are #include <StormByte/config/….hxx>. Namespace root is StormByte::Config.
Existing keys: OnExistingAction (Keep, Overwrite, ThrowException; default is throw).
Add copies or moves the item onto the Config heap (Shared<Base>). After Add, look the node up and mutate it through As.
As<T>() is the typed view of an item. T is either a node type or a leaf tag.
T | Meaning |
|---|---|
Item::Value | The scalar leaf. Assignment writes the payload. |
Item::Integer | int |
Item::Double | double (an Integer is accepted) |
Item::Bool | bool |
Item::Text | StormByte::String::String |
Item::Binary | StormByte::BinaryData |
Item::Group / Item::List | Containers |
Item::Comment<CommentType::…> | Comment specializations |
Integer promotes to Double. Double does not narrow to Integer. A wrong tag throws StormByte::Config::Exception.
Hooks run only on text read (operator<< / >> from a stream or string). They do not run on binary Load.
void (*)(Item::Group&). After-read runs only if parse succeeded.bool (*)(const Item::Group&). Return false to swallow the error; true (or no hook) keeps the throw.std::function are not accepted. A callback with no state is a function pointer. A callback with state is a class that derives from ReadHook or FailureHook and is created with MakePointer.Stateless — inject a default timeout if the file omitted it, and refuse to throw on a known-bad lab fixture:
Stateful — count how many documents a loader accepted and stamp the count into the tree:
MakeReadHook / MakeFailureHook wrap a function pointer in the same Shared type when you already hold a ReadHook::PointerType.
Load returns ExpectedConfig. A bad magic or a newer format version is an error, not a thrown parse of the payload.
String values are StormByte::String::String. Binary values are StormByte::BinaryData. Paths use /. List slots are numeric path segments (list/0).
Issues only on this repository. Fork and open a pull request against master.
From 2.0.0, original StormByte-Config source is dual-licensed:
Neither license covers other StormByte modules or third-party material shipped under thirdparty/ (including bundled StormByte-String and the Base tree it vendors). Those keep their own licenses. Neither license grants patent rights.
Static linking under the LGPL is described under Installation.
StormByte is developed in spare time. Sponsorship is optional and does not buy features, priority or support.