first commit, base server

This commit is contained in:
2020-05-08 12:43:46 +02:00
commit e5078b4969
23 changed files with 955 additions and 0 deletions

27
config_reader.cpp Normal file
View File

@@ -0,0 +1,27 @@
#include "config_reader.h"
#include <iostream>
config_reader::config_reader(std::string dir)
{
this->file.open(dir, std::ios::in);
std::string prueba;
std::getline(file, prueba);
}
bool config_reader::get_param(std::string variable, std::string &value){
this->file.clear();
this->file.seekg(0, file.beg);
std::string line;
while(std::getline(file, line)){
std::string no_coment=line.substr(0,line.find("#"));
std::size_t found=no_coment.find(variable);
if(found!=std::string::npos){
no_coment=no_coment.substr(found+variable.length(), no_coment.length());
found=no_coment.find("=");
if(found!=std::string::npos){
value=no_coment.substr(found+1, no_coment.length());
return true;
}
}
}
return false;
}