7#include <yaml-cpp/yaml.h>
30 inline Level &operator =(
const Level &other) =
default;
35 return std::numeric_limits<unsigned int>::max() ==
_level;
76 inline static constexpr Level invalid() {
return Level(std::numeric_limits<unsigned int>::max()); }
80 if ((0 ==
value) && (0 != range.
min))
91Q_DECLARE_METATYPE(
Level)
102 return Node(rhs.
format().toStdString());
113 if (!node.IsScalar())
116 return rhs.
parse(QString::fromStdString(node.as<std::string>()));
Some simple class implementing a [1-10] level setting.
Definition level.hh:15
bool isNull() const
Test for 0.
Definition level.hh:32
bool parse(const QString &value)
Parses a frequency.
Definition level.cc:22
bool operator!=(const Level &other) const
Definition level.hh:40
bool operator>(const Level &other) const
Definition level.hh:52
unsigned int value() const
Returns the value of the level.
Definition level.hh:60
QString format() const
Format the frequency.
Definition level.cc:12
bool isInvalid() const
Test for invalid level.
Definition level.hh:34
Level()
Default constructor.
Definition level.cc:4
static constexpr Level null()
Constructs null level.
Definition level.hh:74
constexpr Level(unsigned int value)
Constructor from value.
Definition level.hh:18
static constexpr Level fromValue(unsigned int value, const Codeplug::Element::Limit::Range< unsigned int > range={1, 10})
Constructs a proper level.
Definition level.hh:78
static constexpr Level invalid()
Constructs an invalid level.
Definition level.hh:76
bool isFinite() const
Test for finite values.
Definition level.hh:38
bool operator>=(const Level &other) const
Definition level.hh:55
bool operator<(const Level &other) const
Definition level.hh:46
unsigned int _level
The actual level value.
Definition level.hh:87
bool operator==(const Level &other) const
Definition level.hh:43
bool operator<=(const Level &other) const
Definition level.hh:49
Holds a range of values [min, max].
Definition codeplug.hh:94
T mapTo(const Range< T > &other, const T &value) const
Maps a value from this range to the given range.
Definition codeplug.hh:108
const T min
Lower bound.
Definition codeplug.hh:96
static Node encode(const Level &rhs)
Serializes the interval.
Definition level.hh:101
static bool decode(const Node &node, Level &rhs)
Parses the interval.
Definition level.hh:106