BlinkenArea - GitList
Repositories
Blog
Wiki
permissioner
Code
Commits
Branches
Tags
Search
Tree:
f86590f
Branches
Tags
master
permissioner
libpermissioner
src
Float.cpp
make timing configurable, sleep after each file
Stefan Schuermans
commited
f86590f
at 2020-09-19 15:03:32
Float.cpp
Blame
History
Raw
/** * Permissioner: set file ownerships and permissions * Copyright 2020: Stefan Schuermans, Aachen, Germany <stefan@schuermans.info> * Copyleft: GNU GENERAL PUBLIC LICENSE version 3 (see LICENSE) */ #include <permissioner/Float.h> #include <permissioner/StringUtils.h> #include <sstream> #include <stdexcept> #include <string> Float::Float(std::string const &name, float minVal, float maxVal, float defVal) : name(name), minVal(minVal), maxVal(maxVal), val(defVal) {} void Float::parseParams(std::string const ¶mStr) { // format of paramStr is: <floating-point-value> std::string valStr; std::string::size_type pos = 0; StringUtils::getNextField(paramStr, pos, valStr, name); if (pos < paramStr.length()) { std::stringstream msg; msg << "too many fields for \"" << name << "\" in \"" << paramStr << "\""; throw std::runtime_error(msg.str()); } val = StringUtils::str2floatRange(valStr, minVal, maxVal, name); } float Float::get() const { return val; }