7#include <yaml-cpp/yaml.h>
30 inline Level &operator =(
const Level &other) =
default;
35 return std::numeric_limits<unsigned int>::max() ==
_level;
73 inline static constexpr Level invalid() {
return Level(std::numeric_limits<unsigned int>::max()); }
77 if ((0 ==
value) && (0 != range.
min))
88Q_DECLARE_METATYPE(
Level)
99 return Node(rhs.
format().toStdString());
110 if (!node.IsScalar())
113 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:49
unsigned int value() const
Returns the value of the level.
Definition level.hh:57
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:71
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:75
static constexpr Level invalid()
Constructs an invalid level.
Definition level.hh:73
bool isFinite() const
Test for finite values.
Definition level.hh:38
bool operator>=(const Level &other) const
Definition level.hh:52
bool operator<(const Level &other) const
Definition level.hh:43
unsigned int _level
The actual level value.
Definition level.hh:84
bool operator==(const Level &other) const
Definition level.hh:40
bool operator<=(const Level &other) const
Definition level.hh:46
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:98
static bool decode(const Node &node, Level &rhs)
Parses the interval.
Definition level.hh:103