7f605376157cab4b2e524938e78d4ab62d5ff8eb
Stefan Schuermans move most sources into libp...

Stefan Schuermans authored 4 years ago

libpermissioner/src/Config.cpp  1) #include <permissioner/Config.h>
libpermissioner/src/Config.cpp  2) #include <permissioner/StringUtils.h>
Stefan Schuermans begin of permissioner confi...

Stefan Schuermans authored 4 years ago

permissionerd/src/Config.cpp    3) 
Stefan Schuermans move most sources into libp...

Stefan Schuermans authored 4 years ago

libpermissioner/src/Config.cpp  4) #include <permissioner/Tree.h>
Stefan Schuermans begin of permissioner confi...

Stefan Schuermans authored 4 years ago

permissionerd/src/Config.cpp    5) 
permissionerd/src/Config.cpp    6) #include <boost/filesystem.hpp>
permissionerd/src/Config.cpp    7) #include <fstream>
permissionerd/src/Config.cpp    8) #include <map>
permissionerd/src/Config.cpp    9) #include <sstream>
permissionerd/src/Config.cpp   10) #include <stdexcept>
permissionerd/src/Config.cpp   11) #include <string>
permissionerd/src/Config.cpp   12) 
permissionerd/src/Config.cpp   13) void Config::parseFile(std::string const &configFileName) {
permissionerd/src/Config.cpp   14)   std::ifstream configFile(configFileName, std::ios::in);
permissionerd/src/Config.cpp   15)   if (! configFile.is_open()) {
permissionerd/src/Config.cpp   16)     std::stringstream msg;
permissionerd/src/Config.cpp   17)     msg << "cannot open file \"" << configFileName << "\" for reading";
permissionerd/src/Config.cpp   18)     throw std::runtime_error(msg.str());
permissionerd/src/Config.cpp   19)   }
permissionerd/src/Config.cpp   20) 
permissionerd/src/Config.cpp   21)   for (std::string line; std::getline(configFile, line); ) {
permissionerd/src/Config.cpp   22)     std::string::size_type pos = 0;
permissionerd/src/Config.cpp   23)     std::string typeStr;
permissionerd/src/Config.cpp   24)     try {
permissionerd/src/Config.cpp   25)       StringUtils::getNextField(line, pos, typeStr, "config line type");
permissionerd/src/Config.cpp   26)     } catch (std::exception const &e) {
permissionerd/src/Config.cpp   27)       continue; // empty line -> ignore
permissionerd/src/Config.cpp   28)     }
permissionerd/src/Config.cpp   29)     if (typeStr == "#") {
permissionerd/src/Config.cpp   30)       continue; // comment line -> ignore
permissionerd/src/Config.cpp   31)     }
Stefan Schuermans canonicalize root paths

Stefan Schuermans authored 4 years ago

libpermissioner/src/Config.cpp 32)     // actual configuration lines
Stefan Schuermans begin of permissioner confi...

Stefan Schuermans authored 4 years ago

permissionerd/src/Config.cpp   33)     if (typeStr == "tree") {
permissionerd/src/Config.cpp   34)       Tree tree;
permissionerd/src/Config.cpp   35)       tree.parseParams(line.substr(pos));
Stefan Schuermans add config getters

Stefan Schuermans authored 4 years ago

libpermissioner/src/Config.cpp 36)       trees[tree.getRoot()] = tree;
Stefan Schuermans begin of permissioner confi...

Stefan Schuermans authored 4 years ago

permissionerd/src/Config.cpp   37)       continue;
permissionerd/src/Config.cpp   38)     }
permissionerd/src/Config.cpp   39)     // unknown configuration line
permissionerd/src/Config.cpp   40)     std::stringstream msg;
permissionerd/src/Config.cpp   41)     msg << "unknown configuration type \"" << typeStr << "\"";
permissionerd/src/Config.cpp   42)     throw std::runtime_error(msg.str());
permissionerd/src/Config.cpp   43)   }
permissionerd/src/Config.cpp   44) }