1cbbe96195b6154b1957a73808eced432e994792
Stefan Schuermans add copyright & license

Stefan Schuermans authored 4 years ago

libpermissioner/src/StringUtils.cpp  1) /**
libpermissioner/src/StringUtils.cpp  2)  * Permissioner: set file ownerships and permissions
libpermissioner/src/StringUtils.cpp  3)  * Copyright 2020: Stefan Schuermans, Aachen, Germany <stefan@schuermans.info>
libpermissioner/src/StringUtils.cpp  4)  * Copyleft: GNU GENERAL PUBLIC LICENSE version 3 (see LICENSE)
libpermissioner/src/StringUtils.cpp  5)  */
libpermissioner/src/StringUtils.cpp  6) 
Stefan Schuermans move most sources into libp...

Stefan Schuermans authored 4 years ago

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

Stefan Schuermans authored 4 years ago

permissionerd/src/StringUtils.cpp    8) 
Stefan Schuermans add nice and I/O idle config

Stefan Schuermans authored 4 years ago

libpermissioner/src/StringUtils.cpp  9) #include <cstdlib>
Stefan Schuermans begin of permissioner confi...

Stefan Schuermans authored 4 years ago

permissionerd/src/StringUtils.cpp   10) #include <sstream>
Stefan Schuermans add nice and I/O idle config

Stefan Schuermans authored 4 years ago

libpermissioner/src/StringUtils.cpp 11) #include <stdexcept>
Stefan Schuermans begin of permissioner confi...

Stefan Schuermans authored 4 years ago

permissionerd/src/StringUtils.cpp   12) #include <string>
permissionerd/src/StringUtils.cpp   13) 
permissionerd/src/StringUtils.cpp   14) void StringUtils::getNextField(std::string const &str,
permissionerd/src/StringUtils.cpp   15)                                std::string::size_type &pos, std::string &field,
permissionerd/src/StringUtils.cpp   16)                                std::string const &name) {
permissionerd/src/StringUtils.cpp   17)   static const std::string whitespace(" \t");
permissionerd/src/StringUtils.cpp   18) 
permissionerd/src/StringUtils.cpp   19)   std::string::size_type begin = str.find_first_not_of(whitespace, pos);
permissionerd/src/StringUtils.cpp   20)   if (begin == std::string::npos) {
permissionerd/src/StringUtils.cpp   21)     std::stringstream msg;
Stefan Schuermans add nice and I/O idle config

Stefan Schuermans authored 4 years ago

libpermissioner/src/StringUtils.cpp 22)     msg << "<" << name << "> field missing in \"" << str << "\"";
Stefan Schuermans begin of permissioner confi...

Stefan Schuermans authored 4 years ago

permissionerd/src/StringUtils.cpp   23)     throw std::runtime_error(msg.str());
permissionerd/src/StringUtils.cpp   24)   }
permissionerd/src/StringUtils.cpp   25) 
permissionerd/src/StringUtils.cpp   26)   std::string::size_type end = str.find_first_of(whitespace, begin);
permissionerd/src/StringUtils.cpp   27)   if (end == std::string::npos) {
permissionerd/src/StringUtils.cpp   28)     end = str.length();
permissionerd/src/StringUtils.cpp   29)   }
permissionerd/src/StringUtils.cpp   30)   field = str.substr(begin, end - begin);
permissionerd/src/StringUtils.cpp   31) 
permissionerd/src/StringUtils.cpp   32)   pos = str.find_first_not_of(whitespace, end);
permissionerd/src/StringUtils.cpp   33)   if (pos == std::string::npos) {
permissionerd/src/StringUtils.cpp   34)     pos = str.length();
permissionerd/src/StringUtils.cpp   35)   }
permissionerd/src/StringUtils.cpp   36) }