G-TOML is a C++ library for parsing TOML (Tom's Obvious, Minimal Language) files. It allows you to read and manipulate TOML configuration files in your C++ applications.
-
TOML Parsing: G-TOML provides a robust parser for TOML files, allowing you to read and manipulate TOML data in your C++ applications.
-
Simple API: The library offers an easy-to-use API for interacting with TOML data, making it straightforward to read and modify configuration files.
-
Data Types: G-TOML supports various data types, including strings, integers, floating-point numbers, booleans, arrays, and tables.
Follow these instructions to get started with G-TOML in your C++ project.
- C++17 or higher.
- CMake (for building).
-
Clone the G-TOML repository to your local machine.
git clone https://github.com/GmosNM/G-TOML.git
-
Build the library using CMake.
cd G-TOML cmake -GNinja -B bld cmake --build bld
-
Link the G-TOML library to your C++ project.
cmake_minimum_required(VERSION 3.12)
project(G-TOML-TEST)
set(CMAKE_CXX_STANDARD 17)
# path to g-toml directory
add_subdirectory(G-TOML)
add_executable(G-TOML-TEST main.cpp)
target_link_libraries(G-TOML-TEST libgtoml)
Here's a basic example of how to use G-TOML to parse a TOML file:
#include <iostream>
#include "gtoml/parser.hpp"
int main() {
GTOML::Parser parser("config.toml");
if (parser.parse()) {
// Access and manipulate TOML data here
} else {
std::cerr << "Failed to parse TOML file." << std::endl;
}
return 0;
}
For more detailed usage and examples, please refer to the documentation.
Contributions are welcome! If you'd like to contribute to G-TOML, please follow our contribution guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
- G-TOML is inspired by the TOML specification.
For any questions or issues, please open a GitHub issue on the project repository.