mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +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
|
||||
{
|
||||
return this->m_code;
|
||||
return m_code;
|
||||
}
|
||||
|
||||
bool CSelcal::equalsString(const QString &code) const
|
||||
{
|
||||
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> f;
|
||||
if (!CSelcal::isValidCode(this->m_code)) return f;
|
||||
f.reserve(this->m_code.length());
|
||||
for (int pos = 0; pos < this->m_code.length(); pos++)
|
||||
if (!CSelcal::isValidCode(m_code)) return f;
|
||||
f.reserve(m_code.length());
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ class QStringList;
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace PhysicalQuantities { class CFrequency; }
|
||||
|
||||
namespace Aviation
|
||||
{
|
||||
/*!
|
||||
@@ -50,20 +49,21 @@ namespace BlackMisc
|
||||
CSelcal(const char *code) : m_code(QString(code).trimmed().toUpper()) {}
|
||||
|
||||
//! Is valid?
|
||||
bool isValid() const { return isValidCode(this->m_code); }
|
||||
bool isValid() const { return isValidCode(m_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
|
||||
* \return either 4 frequencies, or empty list
|
||||
*/
|
||||
QList<BlackMisc::PhysicalQuantities::CFrequency> getFrequencies() const;
|
||||
//! List of 4 frequencies, if list is empty SELCAL code is not valid
|
||||
//! \return either 4 frequencies, or empty list
|
||||
QList<PhysicalQuantities::CFrequency> getFrequencies() const;
|
||||
|
||||
//! Equals given string
|
||||
bool equalsString(const QString &code) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! Valid SELCAL characters
|
||||
static const QString &validCharacters();
|
||||
|
||||
@@ -74,13 +74,11 @@ namespace BlackMisc
|
||||
static bool isValidCode(const QString &code);
|
||||
|
||||
//! 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 ...
|
||||
static const QStringList &codePairs();
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
private:
|
||||
QString m_code;
|
||||
|
||||
Reference in New Issue
Block a user