Add toml++ and it's example program
This commit is contained in:
parent
2209bda83f
commit
f69cd94c53
4 changed files with 23 additions and 0 deletions
|
|
@ -7,4 +7,6 @@ project(
|
|||
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
find_package(tomlplusplus REQUIRED)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
clang-tools
|
||||
cmake
|
||||
cmake-language-server
|
||||
tomlplusplus
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
add_executable(Hello helloWorld.cpp)
|
||||
add_executable(tomlParse tomlParse.cpp)
|
||||
|
|
|
|||
19
src/tomlParse.cpp
Normal file
19
src/tomlParse.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include <iostream>
|
||||
#include <toml++/toml.hpp>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
toml::table tbl;
|
||||
try
|
||||
{
|
||||
tbl = toml::parse_file(argv[1]);
|
||||
std::cout << tbl << "\n";
|
||||
}
|
||||
catch (const toml::parse_error& err)
|
||||
{
|
||||
std::cerr << "Parsing failed:\n" << err << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue