4 #include <yaml-cpp/yaml.h>
15 Automatic, Hz, kHz, MHz, GHz
53 bool parse(
const QString &value);
83 return Node(rhs.
format().toStdString());
88 if (! node.IsScalar())
90 return rhs.
parse(QString::fromStdString(node.as<std::string>()));
Helper type to encode frequencies without any rounding error.
Definition: frequency.hh:11
static Frequency fromkHz(double kHz)
Unit conversion.
Definition: frequency.hh:63
double inkHz() const
Unit conversion.
Definition: frequency.hh:58
static Frequency fromString(const QString &freq)
Pareses a frequency.
Definition: frequency.cc:104
bool operator<(const Frequency &other) const
Definition: frequency.hh:31
bool operator>=(const Frequency &other) const
Definition: frequency.hh:46
bool operator!=(const Frequency &other) const
Definition: frequency.hh:40
static Frequency fromMHz(double MHz)
Unit conversion.
Definition: frequency.hh:64
unsigned long long inHz() const
Unit conversion.
Definition: frequency.hh:57
Frequency()
Default constructor.
Definition: frequency.cc:11
bool operator>(const Frequency &other) const
Definition: frequency.hh:43
bool parse(const QString &value)
Parses a frequency.
Definition: frequency.cc:53
QString format(Format f=Format::Automatic) const
Format the frequency.
Definition: frequency.cc:30
double inMHz() const
Unit conversion.
Definition: frequency.hh:59
double inGHz() const
Unit conversion.
Definition: frequency.hh:60
unsigned long long _frequency
The actual frequency in Hz.
Definition: frequency.hh:69
Format
Possible formatting hints.
Definition: frequency.hh:14
Frequency & operator=(const Frequency &other)
Assignment.
Definition: frequency.cc:24
static Frequency fromGHz(double GHz)
Unit conversion.
Definition: frequency.hh:65
static Frequency fromHz(unsigned long long Hz)
Unit conversion.
Definition: frequency.hh:62
bool operator==(const Frequency &other) const
Definition: frequency.hh:37
bool operator<=(const Frequency &other) const
Definition: frequency.hh:34
static Node encode(const Frequency &rhs)
Serializes the frequency.
Definition: frequency.hh:82
static bool decode(const Node &node, Frequency &rhs)
Parses the frequency.
Definition: frequency.hh:87