Commit dc007502 authored by LEFEBVREJP email's avatar LEFEBVREJP email
Browse files

Merge branch 'cfg-comments' into 'master'

Updated cfgfile to allow for '!' comment and trailing '/' character.

See merge request !116
parents 166d2cfd 626378cd
Pipeline #158903 passed with stages
in 18 minutes and 45 seconds
......@@ -21,6 +21,8 @@ radix::CFGFile::CFGFile(const std::string& file)
// trim string
line = radix::trim_string(line);
if (line.empty()) continue;
// skip comment
if (line[0] == '!') continue;
if (!key_captured)
{
// capture the key
......@@ -45,11 +47,15 @@ radix::CFGFile::CFGFile(const std::string& file)
<< "' with out '=' character." << std::endl;
std::string key = line.substr(0, pos);
std::string value = line.substr(pos + 1);
// remove trailing ','
auto comma_pos = value.find(",");
if (comma_pos != std::string::npos)
char trails[2] = {',', '/'};
// remove trailing characters
for (auto trail : trails)
{
value = value.erase(comma_pos);
auto comma_pos = value.find(trail);
if (comma_pos != std::string::npos)
{
value = value.erase(comma_pos);
}
}
// trim strings
key = radix::trim_string(key);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment