Compare commits

..

2 Commits
cmake ... dev

Author SHA1 Message Date
marcelb d00eee88d6 Memory leak fix 3 weeks ago
marcelb 729812bcf8 Update 3 weeks ago
  1. 3
      README.md
  2. 1
      example/config.cfg
  3. 5
      src/config.cpp
  4. 3
      test/test.cpp

@ -13,10 +13,11 @@ Easily load variable configuration parameters into your program using this libra
- Predefined necessary keys and enabled validation - Predefined necessary keys and enabled validation
- Strict configuration file format - Strict configuration file format
- Comments in configuration file supported - Comments in configuration file supported
- Update config file from program
## Installation ## 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++ ```c++
#include "config/lib/config.hpp" #include "config/lib/config.hpp"

@ -10,3 +10,4 @@ DinioServer1Port=5000;
DinioServer2Port=4048; 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 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; # 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) { string marcelb::config::operator[](const string& key) {
return element[key]; if (element.count(key)) {
return element[key];
}
return "";
} }
void marcelb::config::update(const string& key, const string& value) { void marcelb::config::update(const string& key, const string& value) {

@ -1,5 +1,6 @@
#include <iostream> #include <iostream>
#include "../lib/config.hpp" #include "../lib/config.hpp"
#include <unistd.h>
using namespace std; using namespace std;
using namespace marcelb; using namespace marcelb;
@ -12,6 +13,6 @@ int main() {
mycfg.update("Baba2", "Janja"); mycfg.update("Baba2", "Janja");
cout << mycfg["Baba"]; cout << mycfg["Baba"];
sleep(10000);
return 0; return 0;
} }
Loading…
Cancel
Save