mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
Ref T129, SELCAL class formatting
This commit is contained in:
committed by
Mathew Sutcliffe
parent
d6aa535236
commit
6fbf601aea
@@ -27,23 +27,23 @@ namespace BlackMisc
|
|||||||
|
|
||||||
QString CSelcal::convertToQString(bool /** i18n **/) const
|
QString CSelcal::convertToQString(bool /** i18n **/) const
|
||||||
{
|
{
|
||||||
return this->m_code;
|
return m_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSelcal::equalsString(const QString &code) const
|
bool CSelcal::equalsString(const QString &code) const
|
||||||
{
|
{
|
||||||
if (code.isEmpty()) return false;
|
if (code.isEmpty()) return false;
|
||||||
return (this->m_code.compare(code, Qt::CaseInsensitive) == 0);
|
return (m_code.compare(code, Qt::CaseInsensitive) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<CFrequency> CSelcal::getFrequencies() const
|
QList<CFrequency> CSelcal::getFrequencies() const
|
||||||
{
|
{
|
||||||
QList<CFrequency> f;
|
QList<CFrequency> f;
|
||||||
if (!CSelcal::isValidCode(this->m_code)) return f;
|
if (!CSelcal::isValidCode(m_code)) return f;
|
||||||
f.reserve(this->m_code.length());
|
f.reserve(m_code.length());
|
||||||
for (int pos = 0; pos < this->m_code.length(); pos++)
|
for (int pos = 0; pos < m_code.length(); pos++)
|
||||||
{
|
{
|
||||||
f.append(CSelcal::audioFrequencyEquivalent(this->m_code.at(pos)));
|
f.append(CSelcal::audioFrequencyEquivalent(m_code.at(pos)));
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ class QStringList;
|
|||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
namespace PhysicalQuantities { class CFrequency; }
|
namespace PhysicalQuantities { class CFrequency; }
|
||||||
|
|
||||||
namespace Aviation
|
namespace Aviation
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
@@ -50,20 +49,21 @@ namespace BlackMisc
|
|||||||
CSelcal(const char *code) : m_code(QString(code).trimmed().toUpper()) {}
|
CSelcal(const char *code) : m_code(QString(code).trimmed().toUpper()) {}
|
||||||
|
|
||||||
//! Is valid?
|
//! Is valid?
|
||||||
bool isValid() const { return isValidCode(this->m_code); }
|
bool isValid() const { return isValidCode(m_code); }
|
||||||
|
|
||||||
//! Get SELCAL code
|
//! Get SELCAL code
|
||||||
const QString &getCode() const { return this->m_code; }
|
const QString &getCode() const { return m_code; }
|
||||||
|
|
||||||
/*!
|
//! List of 4 frequencies, if list is empty SELCAL code is not valid
|
||||||
* List of 4 frequencies, if list is empty SELCAL code is not valid
|
//! \return either 4 frequencies, or empty list
|
||||||
* \return either 4 frequencies, or empty list
|
QList<PhysicalQuantities::CFrequency> getFrequencies() const;
|
||||||
*/
|
|
||||||
QList<BlackMisc::PhysicalQuantities::CFrequency> getFrequencies() const;
|
|
||||||
|
|
||||||
//! Equals given string
|
//! Equals given string
|
||||||
bool equalsString(const QString &code) const;
|
bool equalsString(const QString &code) const;
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||||
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
//! Valid SELCAL characters
|
//! Valid SELCAL characters
|
||||||
static const QString &validCharacters();
|
static const QString &validCharacters();
|
||||||
|
|
||||||
@@ -74,13 +74,11 @@ namespace BlackMisc
|
|||||||
static bool isValidCode(const QString &code);
|
static bool isValidCode(const QString &code);
|
||||||
|
|
||||||
//! Audio frequency for character
|
//! Audio frequency for character
|
||||||
static const BlackMisc::PhysicalQuantities::CFrequency &audioFrequencyEquivalent(QChar c);
|
static const PhysicalQuantities::CFrequency &audioFrequencyEquivalent(QChar c);
|
||||||
|
|
||||||
//! All valid code pairs: AB, AC, AD ...
|
//! All valid code pairs: AB, AC, AD ...
|
||||||
static const QStringList &codePairs();
|
static const QStringList &codePairs();
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
|
||||||
QString convertToQString(bool i18n = false) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_code;
|
QString m_code;
|
||||||
|
|||||||
Reference in New Issue
Block a user