This module provides interface with TOML files. More...
Functions | |
bool | GC_namespace::file_TOML_to_GC (string_view file_name, GenericContainer &gc) |
bool | GC_namespace::TOML_to_GC (istream_type &stream, GenericContainer &gc) |
bool | GC_namespace::TOML_to_GC (string const &DATA, GenericContainer &gc) |
void | GC_namespace::GC_to_TOML (GenericContainer const &gc, std::string &res) |
void | GC_namespace::GC_to_TOML (GenericContainer const &gc, ostream_type &stream) |
This module provides interface with TOML files.
The GenericContainer (GC) module offers a flexible container for storing various data types such as booleans, integers, floating-point numbers, complex numbers, and strings. It also supports structured data types such as vectors and maps. The C++ interface allows for seamless interaction with the container, enabling users to perform operations like adding elements, retrieving data, and managing hierarchical structures.
This tutorial explains how to use the GenericContainer TOML interface for converting between TOML data and the GenericContainer object.
The GenericContainer is a flexible structure that can store various data types like booleans, integers, floating-point numbers, complex numbers, strings, vectors, and maps. The interface provides multiple ways to convert TOML files, streams, or strings into GenericContainer objects and vice versa.
There are several ways to load TOML data into a GenericContainer.
The file_TOML_to_GC function reads TOML data from a file and populates a GenericContainer. This is useful for handling configuration files or other data stored in TOML format.
Example:
The TOML_to_GC function allows loading TOML data from an input stream, such as a file stream or a string stream.
Example:
You can convert a TOML string directly into a GenericContainer using the TOML_to_GC function.
Example:
If you have multiple TOML strings in a vector, you can load them into a GenericContainer using the TOML_to_GC function.
Example:
You can also convert a GenericContainer back to TOML format.
You can write the contents of a GenericContainer to an output stream (e.g., a file) in TOML format using the GC_to_TOML function.
Example:
|
inline |
Convert a TOML file to a GenericContainer.
This function reads TOML data from the provided input stream and populates the given GenericContainer with the parsed data.
[in] | file_name | Input file name containing TOML data. |
[out] | gc | The GenericContainer to be populated. |
|
inline |
Convert a GenericContainer to a TOML file stream.
This function converts the contents of the provided GenericContainer into TOML format and writes it to the specified output stream.
[in] | gc | The GenericContainer to convert. |
[out] | stream | Output stream to write the TOML data. |
|
inline |
Convert a vector of TOML strings to a GenericContainer.
This function parses each string in the given vector as TOML and populates the specified GenericContainer with the resulting data.
[in] | gc | The GenericContainer to convert. |
[out] | DATA | String to store the TOML encoded GenericContainer. |
|
inline |
Convert a TOML file stream to a GenericContainer.
This function reads TOML data from the provided input stream and populates the given GenericContainer with the parsed data.
[in] | stream | Input stream containing TOML data. |
[out] | gc | The GenericContainer to be populated. |
|
inline |
Convert a TOML string to a GenericContainer.
This function parses the given TOML string and populates the specified GenericContainer with the resulting data.
[in] | DATA | The TOML string to parse. |
[out] | gc | The GenericContainer to be populated. |