Skip to content
forked from skystrife/cpptoml

cpptoml is a header-only library for parsing TOML

License

Notifications You must be signed in to change notification settings

dcdillon/cpptoml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpptoml

A header-only library for parsing TOML configuration files.

Targets: d9f4282287967bf2f42ac4426dc1cf69ec608b10

It is reasonably conformant, with the exception of unicode characters in strings.

Alternatives:

  • ctoml is another C++11 implementation of a TOML parser. The approach taken in both for parsing is similar, but the output format is dramatically different---ctoml uses a compact union approach where cpptoml uses an inheritance hierarchy with type erasure. This means that cpptoml will use familiar standard types like std::string and std::vector, but potentially at the expense of runtime performance.
  • libtoml is a C implementation of a TOML parser, which can be linked to from your C++ programs easily.

Test Results

The following two tests are the only failing tests from the toml-test suite.

Test: string-escapes (valid)

Error running test: Could not decode JSON output from parser: invalid character '\f' in string literal
-------------------------------------------------------------------------------
Test: unicode-escape (valid)

Error running test: exit status 1

54 passed, 2 failed

Compilation

Requires a well conforming C++11 compiler. My recommendation is clang++ with libc++ and libc++abi, as this combination can't really be beat in terms of completed features + ABI support on Linux and OSX.

Compiling the examples can be done with cmake:

mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Debug

Example Usage

See the root directory files parse.cpp and parse_stdin.cpp for an example usage.

About

cpptoml is a header-only library for parsing TOML

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 89.9%
  • CMake 8.8%
  • Shell 1.3%