Skip to content

Commit b0f5b77

Browse files
- Updated readme
1 parent 2e3a891 commit b0f5b77

File tree

1 file changed

+163
-141
lines changed

1 file changed

+163
-141
lines changed

README.md

Lines changed: 163 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,33 @@
11
# YAIP++ - Yet another INI parser
22

3-
## General information
4-
5-
[![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](http://www.gnu.org/licenses/lgpl-3.0 "LGPL-3.0")
6-
[![Version](https://img.shields.io/github/release/ThirtySomething/YAIP.svg?maxAge=360)](# "Latest Release")
7-
[![GitHub issues](https://img.shields.io/github/issues/ThirtySomething/YAIP.svg?maxAge=360)](# "Open Issues")
8-
<!--
9-
[![Build Status](https://travis-ci.org/ThirtySomething/YAIP.svg?branch=master)](https://travis-ci.org/ThirtySomething/YAIP "YAIP++@Travis-CI")
10-
11-
[![AUR](https://img.shields.io/aur/votes/YAIP.svg?maxAge=3600)](https://aur.archlinux.org/packages/YAIP/ "Votes")
12-
13-
[![codecov](https://codecov.io/gh/ThirtySomething/YAIP/branch/master/graph/badge.svg)](https://codecov.io/gh/ThirtySomething/YAIP "[email protected]")
3+
## Badges
144

15-
[![Total downloads](https://img.shields.io/github/downloads/ThirtySomething/YAIP/total.svg?maxAge=360)](# "Downloads")
16-
-->
5+
[![License: LGPL v3][yaip_license_badge]][yaip_license] [![Version][yaip_release_badge]][yaip_release] [![GitHub issues][yaip_issues_badge]][yaip_issues]
176

18-
- **YAIP++** is distributed under the terms of the **GNU LESSER GENERAL PUBLIC LICENSE**, version 3.0. The text of the license is included in the file [<code>LICENSE.TXT</code>](https://github.com/ThirtySomething/YAIP/blob/master/LICENSE.TXT "LGPL-3.0") in the project root.
19-
- As testing framework [*Catch*](https://github.com/philsquared/Catch "Catch") is used.
7+
## General information
208

21-
<!--
22-
- The build is done at [*Travis*](https://travis-ci.org "Travis-CI") using the following compilers:
23-
- GCC C++ 4.9
24-
- GCC C++ 5
25-
- CLANG C++ 3.6
26-
- CLANG C++ 3.7.
27-
- For code coverage [*Codecov*](https://codecov.io "Codecov.io") is planned to use.
28-
-->
9+
- **YAIP++** is distributed under the terms of the **GNU LESSER GENERAL PUBLIC LICENSE**, version 3.0. The text of the license is included in the file [<code>LICENSE.TXT</code>][license] in the project root.
10+
- As testing framework [*Catch2*][catch2] is used.
2911

3012
## Requirements
3113

32-
To use **YAIP++** you need to have an modern [C++11](https://en.wikipedia.org/wiki/C%2B%2B11 "C++11") compiler. See the used parts at the section **Implementation Details**. Tested with [Visual Studio 2017](https://www.visualstudio.com/ "Visual Studio").
14+
To use **YAIP++** you need to have an modern [C++11][cpp_eleven] compiler. See the used parts at the section **Implementation Details**. Tested with [Visual Studio 2017][msvs].
3315

3416
## Supported Platforms
3517

3618
Supported platforms are all platforms where the code compiles and the tests run without any error.
3719

3820
## Motivation
3921

40-
Searching for INI parsers for C++ fires up a lot of them. Most of them come with a lot of stuff/classes around, some of them as library. Only a few of them offers plain classes. Also only a few of them are portable. And I'm missing the usage of modern C++ like own [*templates*](https://en.wikipedia.org/wiki/Template_(C%2B%2B) "Templates") and the usage of the [*STL*](https://de.wikipedia.org/wiki/Standard_Template_Library "STL"). I like to improve my C++ skills so I decided to write my own INI file parser.
22+
Searching for INI parsers for C++ fires up a lot of them. Most of them come with a lot of stuff/classes around, some of them as library. Only a few of them offers plain classes. Also only a few of them are portable. And I'm missing the usage of modern C++ like own [*templates*][cpp_templates] and the usage of the [*STL*][cpp_stl]. I like to improve my C++ skills so I decided to write my own INI file parser.
4123

4224
## Implementation Details
4325

4426
* Convenience typedefs for datatypes in <code>YAIP++.h</code>
45-
* Data containers are STL elements like [*vector*](http://en.cppreference.com/w/cpp/container/vector "Vector") or [*map*](http://en.cppreference.com/w/cpp/container/map "Map")
46-
* Detection of section and key/value pair is done using [*regular expressions*](http://en.cppreference.com/w/cpp/regex "Regular Expression"), see also [*regular expression*](https://en.wikipedia.org/wiki/Regular_expression "Regular Expression")
47-
* The major methods are based on [*std::string*](http://en.cppreference.com/w/cpp/string/basic_string "String")
48-
* The templated methods using converters from and to [*std::string*](http://en.cppreference.com/w/cpp/string/basic_string "String")
27+
* Data containers are STL elements like [*vector*][cpp_vector] or [*map*][cpp_map]
28+
* Detection of section and key/value pair is done using [*regular expressions*][cpp_regexp], see also [*regular expression*][wiki_regexp]
29+
* The major methods are based on [*std::string*][cpp_string]
30+
* The templated methods using converters from and to [*std::string*][cpp_string]
4931

5032
## Extension
5133

@@ -57,118 +39,158 @@ A doxygen documentation can be generated, the config file is located in the doxy
5739

5840
## API Overview
5941

60-
### File related actions:
61-
62-
* Load INI file
63-
64-
/**
65-
* Load and parse INI file into internal structures
66-
* \param Filename Full qualified filename of the INI file
67-
* \return true on success otherwise false
68-
*/
69-
bool INIFileLoad(std::string Filename);
70-
71-
* Save INI file
72-
73-
/**
74-
* Save internal structures to INI file
75-
* \param Filename Full qualified filename of the INI file
76-
* \return true on success otherwise false
77-
*/
78-
bool INIFileSave(std::string Filename);
79-
80-
* INI file exists
81-
82-
/**
83-
* Check if given INI file exists
84-
* \param Filename Full qualified filename of the INI file
85-
* \return true if file exists otherwise false
86-
*/
87-
bool INIFileExist(const std::string &Filename) const;
88-
89-
* INI file delete
90-
91-
/**
92-
* Delete given INI file
93-
* \param Filename Full qualified filename of the INI file
94-
* \return true if file is deleted otherwise false
95-
*/
96-
bool INIFileDelete(const std::string &Filename) const;
97-
98-
### Section related actions:
99-
100-
* Get a list of all sections
101-
102-
/**
103-
* Get all sections of the INI file
104-
* \return Vector with a std::strings for each section
105-
*/
106-
tVectorString SectionListGet(void) const;
107-
108-
* Delete a section
109-
110-
/**
111-
* Remove section completely from internal data structure
112-
* \param Section Specified section
113-
*/
114-
void SectionKill(const std::string &Section);
115-
116-
### Key related actions:
117-
118-
* Check if section is empty
119-
120-
/**
121-
* Check if section contains data
122-
* \param Section Specified section
123-
* \return true for empty section otherwise false
124-
*/
125-
bool SectionEmpty(const std::string &Section) const;
126-
127-
128-
* Get a list of keys of a section
129-
130-
/**
131-
* Get all keys of a section of the INI file
132-
* \param Section Specified section
133-
* \return Vector with a std::strings for each key
134-
*/
135-
tVectorString SectionKeyListGet(const std::string &Section) const;
136-
137-
* Get a value of a section/key combination - *Note: This is a templated method and requires in any case a default value.*
138-
139-
/**
140-
* Templated method to retrieve a value of the specified section/key combination
141-
* \param Section Specified section
142-
* \param Key Specified key
143-
* \param Default Specified default value in case key does not exist
144-
* \return Returns either the default value or the value of the existing section/key combination
145-
*/
146-
template<typename VariableType>
147-
VariableType SectionKeyValueGet(const std::string &Section, const std::string &Key, const VariableType &Default);
148-
149-
150-
* Set a value of a section/key combination - *Note: This is a templated method and may require a cast.*
151-
152-
/**
153-
* Templated method to set a value of the specified section/key combination
154-
* \param Section Specified section
155-
* \param Key Specified key
156-
* \param Value Specified value to set
157-
* \return true on success otherwise false
158-
*/
159-
template<typename VariableType>
160-
bool SectionKeyValueSet(const std::string &Section, const std::string &Key, const VariableType &Value);
161-
162-
* Delete a key
163-
164-
/**
165-
* Remove key completely from section of internal data structure
166-
* \param Section Specified section
167-
* \param Key Specified key
168-
*/
169-
void SectionKeyKill(const std::string &Section, const std::string &Key);
42+
### File related actions
43+
44+
- Load INI file
45+
46+
<pre>
47+
/**
48+
* Load and parse INI file into internal structures
49+
* \param Filename Full qualified filename of the INI file
50+
* \return true on success otherwise false
51+
*/
52+
bool INIFileLoad(std::string Filename);
53+
</pre>
54+
55+
- Save INI file
56+
57+
<pre>
58+
/**
59+
* Save internal structures to INI file
60+
* \param Filename Full qualified filename of the INI file
61+
* \return true on success otherwise false
62+
*/
63+
bool INIFileSave(std::string Filename);
64+
</pre>
65+
66+
- Does INI file exists
67+
68+
<pre>
69+
/**
70+
* Check if given INI file exists
71+
* \param Filename Full qualified filename of the INI file
72+
* \return true if file exists otherwise false
73+
*/
74+
bool INIFileExist(const std::string &Filename) const;
75+
</pre>
76+
77+
- Delete INI file
78+
79+
<pre>
80+
/**
81+
* Delete given INI file
82+
* \param Filename Full qualified filename of the INI file
83+
* \return true if file is deleted otherwise false
84+
*/
85+
bool INIFileDelete(const std::string &Filename) const;
86+
</pre>
87+
88+
### Section related actions
89+
90+
- Get a list of all sections
91+
92+
<pre>
93+
/**
94+
* Get all sections of the INI file
95+
* \return Vector with a std::strings for each section
96+
*/
97+
tVectorString SectionListGet(void) const;
98+
</pre>
99+
100+
- Delete a section
101+
102+
<pre>
103+
/**
104+
* Remove section completely from internal data structure
105+
* \param Section Specified section
106+
*/
107+
void SectionKill(const std::string &Section);
108+
</pre>
109+
110+
- Check if section is empty
111+
112+
<pre>
113+
/**
114+
* Check if section contains data
115+
* \param Section Specified section
116+
* \return true for empty section otherwise false
117+
*/
118+
bool SectionEmpty(const std::string &Section) const;
119+
</pre>
120+
121+
### Key related actions
122+
123+
- Get a list of keys of a section
124+
125+
<pre>
126+
/**
127+
* Get all keys of a section of the INI file
128+
* \param Section Specified section
129+
* \return Vector with a std::strings for each key
130+
*/
131+
tVectorString SectionKeyListGet(const std::string &Section) const;
132+
</pre>
133+
134+
- Get a value of a section/key combination - *Note: This is a templated method and requires in any case a default value.*
135+
136+
<pre>
137+
/**
138+
* Templated method to retrieve a value of the specified section/key combination
139+
* \param Section Specified section
140+
* \param Key Specified key
141+
* \param Default Specified default value in case key does not exist
142+
* \return Returns either the default value or the value of the existing section/key combination
143+
*/
144+
template&lt;typename VariableType&gt;
145+
VariableType SectionKeyValueGet(const std::string &Section, const std::string &Key, const VariableType &Default);
146+
</pre>
147+
148+
- Set a value of a section/key combination - *Note: This is a templated method and may require a cast.*
149+
150+
<pre>
151+
/**
152+
* Templated method to set a value of the specified section/key combination
153+
* \param Section Specified section
154+
* \param Key Specified key
155+
* \param Value Specified value to set
156+
* \return true on success otherwise false
157+
*/
158+
template&lt;typename VariableType&gt;
159+
bool SectionKeyValueSet(const std::string &Section, const std::string &Key, const VariableType &Value);
160+
</pre>
161+
162+
- Delete a key
163+
164+
<pre>
165+
/**
166+
* Remove key completely from section of internal data structure
167+
* \param Section Specified section
168+
* \param Key Specified key
169+
*/
170+
void SectionKeyKill(const std::string &Section, const std::string &Key);
171+
</pre>
170172

171173
## ToDo's
172174

173-
* The implementation has to be checked against the inofficial specification at [Wikipedia](https://en.wikipedia.org/wiki/INI_file#Comments) and the tests have to satisfiy the specification.
174-
* Comments are currently not supported - add this feature as desscribed in the specification.
175+
- The implementation has to be checked against the inofficial specification at [Wikipedia][wiki_ini] and the tests have to satisfiy the specification.
176+
- Comments are currently not supported - add this feature as desscribed in the specification.
177+
178+
[catch2]: https://github.com/philsquared/Catch
179+
[cpp_eleven]: https://en.wikipedia.org/wiki/C%2B%2B11
180+
[cpp_map]: http://en.cppreference.com/w/cpp/container/map
181+
[cpp_templates]: https://en.wikipedia.org/wiki/Template_(C%2B%2B)
182+
[cpp_regexp]: http://en.cppreference.com/w/cpp/regex
183+
[cpp_stl]: https://de.wikipedia.org/wiki/Standard_Template_Library
184+
[cpp_string]: http://en.cppreference.com/w/cpp/string/basic_string
185+
[cpp_vector]: http://en.cppreference.com/w/cpp/container/vector
186+
[license]: https://github.com/ThirtySomething/YAIP/blob/master/LICENSE.TXT
187+
[msvs]: https://www.visualstudio.com/
188+
[wiki_ini]: https://en.wikipedia.org/wiki/INI_file#Comments
189+
[wiki_regexp]: https://en.wikipedia.org/wiki/Regular_expression
190+
191+
[yaip_license]: http://www.gnu.org/licenses/lgpl-3.0
192+
[yaip_license_badge]: https://img.shields.io/badge/License-LGPL%20v3-blue.svg
193+
[yaip_release]: # "Latest Release"
194+
[yaip_release_badge]: https://img.shields.io/github/release/ThirtySomething/YAIP.svg?maxAge=360
195+
[yaip_issues]: # "Open Issues"
196+
[yaip_issues_badge]: https://img.shields.io/github/issues/ThirtySomething/YAIP.svg?maxAge=360

0 commit comments

Comments
 (0)