new wiki
commit
ade2bef1c7
|
@ -0,0 +1,54 @@
|
||||||
|
# readconf
|
||||||
|
|
||||||
|
Singleton for reading the configuration file required for your program.
|
||||||
|
|
||||||
|
## Main features
|
||||||
|
|
||||||
|
- Reading multiple configuration files (>=v0.3.0)
|
||||||
|
- Separation of parameters by sections (>=v0.2.0)
|
||||||
|
- Access to parameters and sections using keys and indexes (>=v0.3.0)
|
||||||
|
- Commenting on lines
|
||||||
|
|
||||||
|
## Examples of configuration files.
|
||||||
|
|
||||||
|
### Simple configuration file
|
||||||
|
|
||||||
|
An example of a simple configuration file consists of strings of the format `<parameter><separator><value>`. The **parameter** has a strict notation using characters `A-Z`, `a-z`, `0-9`, `_`, `-`. The **value** is specified by any set of characters (except *special characters*). The `=` or `=>` symbol can act as a separator. Spaces or tabs are possible between all three parts of the template, as well as before or after.
|
||||||
|
|
||||||
|
```conf
|
||||||
|
parameter1=value1
|
||||||
|
parameter2=>value2
|
||||||
|
parameter3=value3
|
||||||
|
parameter4=>value4
|
||||||
|
|
||||||
|
_parameter5 = value5
|
||||||
|
parameter6 => value6
|
||||||
|
parameter7 = value7
|
||||||
|
|
||||||
|
parameter8 => value8
|
||||||
|
parameter9 =value9
|
||||||
|
parameter-10 =>value10
|
||||||
|
parameter11 = value11
|
||||||
|
|
||||||
|
|
||||||
|
parameter12_ => value12
|
||||||
|
```
|
||||||
|
|
||||||
|
### Commenting on lines
|
||||||
|
|
||||||
|
The library allows you to use comments as strings that do not match the template `<parameter><separator><value>`, and specifying them after the **value** using **special characters** to indicate a comment - `;`, `#`, `//`, `/*`. The **value** cannot start with **special characters**. If you need to specify **special characters** at the beginning of the **value**, it is enough to separate the **value** with quotation marks or an apostrophe. There must be at least one space or tab character between the **value** and the **special character**, otherwise the **value** will be read as a whole.
|
||||||
|
|
||||||
|
```conf
|
||||||
|
This line will be a comment, since it does not match the basic template
|
||||||
|
parameter1 => value1 ; This will be a comment
|
||||||
|
parameter2 => value2 # This will be a comment
|
||||||
|
parameter3 => value3 // This will be a comment
|
||||||
|
parameter4 => value4 /* This will be a comment
|
||||||
|
parameter5 => value5;This will not be a comment
|
||||||
|
parameter6 => value6// This will also be a whole value
|
||||||
|
parameter7 => //value7 ;The value will not be read
|
||||||
|
parameter8 => "//value8" # Now the value is correctly
|
||||||
|
parameter9 => ';value9' // The value is correctly too
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sections
|
Loading…
Reference in New Issue