Go to the documentation of this file.
52 const auto colon = str.find(
':');
54 if (colon == std::string::npos)
79 if (readScalar(str, val))
84 else if (str.find(
':', colon+1) != std::string::npos)
93 if (readScalar(str.substr(1), val))
98 else if (colon == str.size()-1)
102 if (readScalar(str.substr(0, colon), val))
110 scalar minVal, maxVal;
113 readScalar(str.substr(0, colon), minVal)
114 && readScalar(str.substr(colon+1), maxVal)
121 return range.valid();
129 if (!parse(str,
range))
131 Info<<
"Bad scalar-range while parsing: " << str <<
endl;
144 type_(max_ < min_ ? scalarRange::NONE : scalarRange::GE_LE)
152 type_(max_ < min_ ? scalarRange::NONE : scalarRange::GE_LE)
162 case scalarRange::EQ:
166 case scalarRange::GE:
167 case scalarRange::GT:
168 os <<
range.min() <<
":Inf";
171 case scalarRange::LE:
172 case scalarRange::LT:
173 os <<
"-Inf:" <<
range.max();
176 case scalarRange::GE_LE:
180 case scalarRange::ALWAYS:
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool good() const noexcept
True if the Switch represents a valid enumeration.
static Switch find(const std::string &str)
static const scalarRange always
A range that always matches.
static bool parse(const std::string &str, scalarRange &range)
Construct by parsing string content.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
static const scalarRange null
An empty/inverted range that never matches.
messageStream Info
Information stream (uses stdout - output is on the master only)
Scalar bounds to be used as a unary predicate.
scalarRange() noexcept
Construct an empty (inverse) range.
static scalarRange le(const scalar maxVal) noexcept
Construct a less-equals bound.
static scalarRange ge(const scalar minVal) noexcept
Construct a greater-equals bound.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A min/max value pair with additional methods. In addition to conveniently storing values,...