The cppcson C++ library provides a simple api to parse and write *.cson files.
Features:
- Meta information for parsed values (line, column etc.)
- Proper error reporting
- No dependencies
- Thread safe
- Support for \u escapes in strings
Tested on:
- Linux g++ 8.3.0
- macOS Clang 10.0.1
- Windows Visual Studio 2019
Note:
- The parser interprets the input as encoded in UTF-8. To use other Unicode encodings such as UTF-16, have a look on utf8streams.
- CMake (version 3.10 or later)
- A C++11 compatible compiler such as g++ or clang
- Googletest (only for tests)
On Unix systems:
mkdir build
cd build
cmake .. # -DCPPCSON_BUILD_TESTS=OFF to disable tests
make
On Windows:
In the Visual Studio command line:
mkdir build
cd build
cmake -G "NMake Makefiles" .. # -DCPPCSON_BUILD_TESTS=OFF to disable tests
nmake
In case Googletest is not found download the source code, build it and rerun cmake:
cmake -G "NMake Makefiles" -DGTEST_LIBRARY=googletest-release-1.8.1\googletest\build\gtestd.lib -DGTEST_MAIN_LIBRARY=googletest-release-1.8.1\googletest\build\gtest_maind.lib -DGTEST_INCLUDE_DIR=googletest-release-1.8.1\googletest\include ..
Please also note possible incompatibilities between /MDd and /MTd. For more information see this thread.
If tests are enabled, they can be started by executing ctest
in the same folder.
The usage of the library is demonstrated in the Example and Tests folders.