Skip to content

Commit

Permalink
Initial import of cpptoml.
Browse files Browse the repository at this point in the history
  • Loading branch information
skystrife committed May 20, 2013
0 parents commit 46eebfb
Show file tree
Hide file tree
Showing 8 changed files with 2,634 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
*.swp
*.o
.ycm_*
29 changes: 29 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,29 @@
cmake_minimum_required( VERSION 2.8 )
project( cpptoml )

option( USE_LIBCXX "Use libc++ for the C++ standard library" ON )

include_directories( "include/" )

if( UNIX )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic" )
if( USE_LIBCXX )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
endif()
endif()

add_executable( parse parse.cpp )
add_executable( cpptoml parse_stdin.cpp )

find_package( Doxygen )
if( DOXYGEN_FOUND )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cpptoml.doxygen.in
${CMAKE_CURRENT_BINARY_DIR}/cpptoml.doxygen @ONLY
)
add_custom_target( doc
${DOXYGEN_EXECUTABLE}
${CMAKE_CURRENT_BINARY_DIR}/cpptoml.doxygen
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif()
18 changes: 18 additions & 0 deletions LICENSE
@@ -0,0 +1,18 @@
Copyright (c) 2013 Chase Geigle

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 changes: 41 additions & 0 deletions README.md
@@ -0,0 +1,41 @@
# cpptoml
A header-only library for parsing [TOML][toml] configuration files.

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

## Test Results
The following two tests are the only failing tests from [the toml-test
suite][toml-test].

```
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.

[toml]: https://github.com/mojombo/toml
[toml-test]: https://github.com/BurntSushi/toml-test

0 comments on commit 46eebfb

Please sign in to comment.