Skip to content

Commit 307a1f9

Browse files
authored
First version
1 parent 789ed39 commit 307a1f9

10 files changed

Lines changed: 1638 additions & 22 deletions

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Author: Borovik Alexey <alexey@borovik.me>

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CMAKE_MINIMUM_REQUIRED (VERSION 2.6 FATAL_ERROR)
2+
PROJECT(TEST_INI_APP)
3+
# Test application
4+
ADD_EXECUTABLE(test_ini_app iniparser.hpp test_app.cpp)

LICENSE

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2017 Lek-sys
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
MIT License
2+
3+
Copyright (c) 2017 Lek-sys
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,75 @@
1-
# LeksysINI
1+
/===============================================================================================================\
2+
| _ _ _ ___ _ _ ___ ____ |
3+
| | | ___| | _____ _ _ ___( ) |_ _| \ | |_ _| _ \ __ _ _ __ ___ ___ _ __ |
4+
| | | / _ \ |/ / __| | | / __|/ | || \| || || |_) / _` | '__/ __|/ _ \ '__| |
5+
| | |__| __/ <\__ \ |_| \__ \ | || |\ || || __/ (_| | | \__ \ __/ | |
6+
| |_____\___|_|\_\___/\__, |___/ |___|_| \_|___|_| \__,_|_| |___/\___|_| |
7+
| |___/ |
8+
| by Borovik Alexey |
9+
\===============================================================================================================/
10+
11+
Crossplatform all-in-one INI-file parser, written on C++ with STL
12+
13+
|---------------------------------------------------------------------------------------------------------------|
14+
| Advantages |
15+
|---------------------------------------------------------------------------------------------------------------|
16+
17+
• Residents in single file - iniparser.hpp. Simply include it to your project and use
18+
• Crossplatform (Windows & POSIX)
19+
• Nice and easy-to-use C++ interface
20+
• Extends standart INI interface with:
21+
-> Arrays (comma-separated values) support
22+
-> Nested sections [parent.child] support
23+
-> File includes (;#include <file_path>)
24+
• Can be used to save and load any user-defined classes, as long as stream operators are provided
25+
• Supports multilines
26+
• Loads & saves comments
27+
• MIT license
28+
29+
|---------------------------------------------------------------------------------------------------------------|
30+
| Usage |
31+
|---------------------------------------------------------------------------------------------------------------|
32+
33+
Include provided iniparser.hpp to your C++ project and that is all
34+
Usage information can be found on project's GitHub page
35+
Look in test_app.cpp for different ways of using Leksys' IniParser
36+
For testing purposes you can compile provided test application (see next section)
37+
38+
|---------------------------------------------------------------------------------------------------------------|
39+
| Building Test Application |
40+
|---------------------------------------------------------------------------------------------------------------|
41+
You need to install CMake before building test_app
42+
CMake binary for your platform can be found at:
43+
http://www.cmake.org/cmake/resources/software.html
44+
45+
1. POSIX (Linux, QNX, FreeBSD, MacOS)
46+
In console type:
47+
# mkdir build; cd build
48+
# cmake <this_file_dir>
49+
# make
50+
51+
2. Windows
52+
Use cmake-gui application for building project files for your
53+
IDE (currently supported: Visual Studio, Borland C++, CodeBlocks (MinGW), Eclipse (MinGW)).
54+
55+
Under QtCreator (v. 2.2.1) you can open Cmake projects directly from the
56+
IDE (File -> Open Project)
57+
58+
Alternatively, if you want to build project for Visual Studio, you can
59+
do it directly from the console in true-Linux style =):
60+
61+
# mkdir build; cd build
62+
# cmake <this_file_dir>
63+
# %VS90COMNTOOLS%\vsvars32.bat
64+
# nmake
65+
66+
Note, that if you have Visual Studio 10.0 (2010) environment variable will
67+
be %VS100COMNTOOLS% and so on.
68+
69+
|---------------------------------------------------------------------------------------------------------------|
70+
| Running Test Application |
71+
|---------------------------------------------------------------------------------------------------------------|
72+
1. Simply start application and ensure, that 10 first tests pass.
73+
2. Start application with parameters:
74+
-i <this_file_dir>/ini-test/test1.ini -o out_file.ini
75+
and ensure that file <application_dir>/out_file.ini contains all the stuff from ini files in test directory
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[SubSub]
2+
val7 = 77
3+
array7 = h,e,l,l,o

ini-test/subfiles/subtest1.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
val = 10 ; This will appear in Settings.Sub2 section
2+
multival = 1, 2, 3, 4, 5, \
3+
6, 7, 8, 9, 10, \
4+
And a string
5+
6+
; Nested include section
7+
;#include subfiles/sub2.ini

ini-test/test1.ini

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
; Comment line
2+
# Comment line 2
3+
;#include test2.ini
4+
5+
global_int = 1
6+
global_str = Hello! This is just a sample string \
7+
That is multiline \
8+
Simple as that
9+
10+
; Main section
11+
[Main]
12+
int = 1 ; Integer value
13+
double = 2.303 ; Double value
14+
str = Hello! This is string! ; String
15+
bool = true ; Boolean value
16+
array = 1, 202.56, String with space, 5 ; Array
17+
18+
; Second section
19+
[Settings]
20+
val1 = 5 ; Plain int
21+
; Array value
22+
val2 = 505.67, 202.35
23+
24+
; Subsection
25+
[Settings.Sub1]
26+
; String value in subsection
27+
ret = String
28+
# Int value in subsection
29+
ret2 = 201
30+
31+
[Settings.Sub2] ; Inline comment
32+
;#include subfiles/subtest1.ini
33+
34+
[Uncommented]
35+
val1 = 1
36+
val2 = 2

ini-test/test2.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; Section main : 1st comment
2+
[Main]
3+
int = 5 ; This will be overwritten
4+
sval = 456.5 ;
5+
sval2 = String It!
6+
7+
[Section2]
8+
go = true
9+
10+
; Êîììåíòàðèé íà ðóññêîì
11+
[Ñåêöèÿ 3]
12+
ïåðåìåííàÿ = çíà÷åíèå ; Ïîëíîñòüþ ðóññêèé ñåãìåíò

0 commit comments

Comments
 (0)