Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d00eee88d6 | |||
| 729812bcf8 |
@ -13,10 +13,11 @@ Easily load variable configuration parameters into your program using this libra
|
||||
- Predefined necessary keys and enabled validation
|
||||
- Strict configuration file format
|
||||
- Comments in configuration file supported
|
||||
- Update config file from program
|
||||
|
||||
## Installation
|
||||
|
||||
Just download the latest release and unzip it into your project. You can turn it on with:
|
||||
Just download the latest release and use cmake build system
|
||||
|
||||
```c++
|
||||
#include "config/lib/config.hpp"
|
||||
|
||||
@ -10,3 +10,4 @@ DinioServer1Port=5000;
|
||||
DinioServer2Port=4048;
|
||||
DinioGetIPURL=http://lab-it.ddns.net/getip/index.php; #ovo ide na više A recorda i više servera pod istim domenom
|
||||
# DinioGetIPURL2=http://ns-hl.ddns.net/getip/index.php;
|
||||
Baba2=Janja;
|
||||
|
||||
@ -14,7 +14,10 @@ marcelb::config::config(const string _configFilePath, const vector<string> _nece
|
||||
|
||||
|
||||
string marcelb::config::operator[](const string& key) {
|
||||
if (element.count(key)) {
|
||||
return element[key];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void marcelb::config::update(const string& key, const string& value) {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include <iostream>
|
||||
#include "../lib/config.hpp"
|
||||
#include <unistd.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace marcelb;
|
||||
@ -12,6 +13,6 @@ int main() {
|
||||
mycfg.update("Baba2", "Janja");
|
||||
cout << mycfg["Baba"];
|
||||
|
||||
|
||||
sleep(10000);
|
||||
return 0;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user