File tree Expand file tree Collapse file tree 8 files changed +58
-26
lines changed Expand file tree Collapse file tree 8 files changed +58
-26
lines changed Original file line number Diff line number Diff line change
1
+ [* ]
2
+ insert_final_newline = true
3
+ charset = utf-8
4
+ indent_size = 4
5
+ indent_style = tab
6
+ # Optional: git will commit as lf, this will only affect local files
7
+ end_of_line = lf
8
+
9
+ [* .{py,md,yml,sh,cmake} ]
10
+ indent_style = space
11
+ indent_size = 2
12
+
13
+ [* .{py,md,yml,sh}.in ]
14
+ indent_style = space
15
+ indent_size = 2
16
+
17
+ [CMakeLists.txt ]
18
+ indent_style = space
19
+ indent_size = 2
Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.19 )
2
2
3
3
project (pini )
4
- add_executable (${PROJECT_NAME} src/main.cpp
5
- src/util.cpp
6
- src/pini.cpp )
4
+ add_library (${PROJECT_NAME} src/util.cpp
5
+ src/util.hpp
6
+ src/pini.cpp
7
+ include /pini/pini.hpp )
8
+ add_library (pini::pini ALIAS pini )
9
+ target_include_directories (${PROJECT_NAME} PRIVATE src PUBLIC include )
7
10
target_compile_options (${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror=return-type )
8
11
target_compile_features (${PROJECT_NAME} PRIVATE cxx_std_17 )
9
12
13
+ option (PINI_BUILD_TESTS "Build tests" ON )
14
+
15
+ if (PINI_BUILD_TESTS )
16
+ enable_testing ()
17
+ add_subdirectory (test )
18
+ endif ()
19
+
10
20
set (CCJSON "${CMAKE_CURRENT_BINARY_DIR} /compile_commands.json" )
11
21
if (EXISTS "${CCJSON} " )
12
22
message (STATUS "Copying ${CCJSON} to project root" )
13
23
file (COPY "${CCJSON} " DESTINATION "${PROJECT_SOURCE_DIR} " )
14
- endif ()
24
+ endif ()
Original file line number Diff line number Diff line change 6
6
#include < string_view>
7
7
#include < unordered_map>
8
8
#include < vector>
9
- #include " util.hpp"
10
9
11
10
namespace pn {
12
11
class pini {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- #include " pini.hpp"
2
1
#include < cstddef>
3
2
#include < cstdint>
4
3
#include < sstream>
5
4
#include < string_view>
6
5
#include < vector>
7
- #include " util.hpp"
6
+ #include < pini/pini.hpp>
7
+ #include < util.hpp>
8
+
8
9
9
10
namespace pn {
10
11
namespace {
Original file line number Diff line number Diff line change 1
- #include " util.hpp"
2
1
#include < cassert>
2
+ #include < util.hpp>
3
3
4
4
namespace util {
5
5
Original file line number Diff line number Diff line change
1
+ cmake_minimum_required (VERSION 3.19 )
2
+
3
+ project (pini-test )
4
+ add_executable (${PROJECT_NAME} pini_test.cpp )
5
+ target_link_libraries (${PROJECT_NAME} PRIVATE pini::pini )
6
+ target_compile_options (${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror=return-type )
7
+ target_compile_features (${PROJECT_NAME} PRIVATE cxx_std_17 )
8
+
9
+ add_test (pini-test pini-test )
Original file line number Diff line number Diff line change
1
+ #include < ios>
2
+ #include < iostream>
3
+ #include < pini/pini.hpp>
4
+
5
+ int main () {
6
+ pn::pini pin;
7
+
8
+ std::string_view raw_input{" a=5\n b=10\n 23=c" };
9
+ // std::filesystem::path filename{"/test/test.ini"};
10
+ if (!pin.load_text (raw_input)) { return 1 ; }
11
+ if (pin.get_int32 (" a" ) != 5 ) { return 1 ; }
12
+ }
You can’t perform that action at this time.
0 commit comments