Ref T219, added some utility functions in value classes

This commit is contained in:
Klaus Basan
2018-01-07 03:09:54 +01:00
parent b982b7aca6
commit 93d1dcfc1d
7 changed files with 29 additions and 7 deletions

View File

@@ -73,10 +73,13 @@ namespace BlackMisc
void setPassword(const QString &pw) { m_password = pw.trimmed(); }
//! Valid user object?
bool isValid() const { return !m_realname.isEmpty() && !m_id.isEmpty(); }
bool isValid() const { return !isNull(); }
//! Null?
bool isNull() const { return m_realname.isEmpty() && m_id.isEmpty(); }
//! Valid credentials?
bool hasValidCredentials() const { return this->isValid() && !m_password.isEmpty(); }
bool hasCredentials() const { return this->isValid() && !m_password.isEmpty(); }
//! Valid real name?
bool hasRealName() const { return !m_realname.isEmpty(); }
@@ -84,12 +87,18 @@ namespace BlackMisc
//! Valid id?
bool hasId() const { return !m_id.isEmpty(); }
//! Has a valid VATSIM id?
bool hasValidVatsimId() const { return CUser::isValidVatsimId(this->getId()); }
//! Has associated callsign?
bool hasCallsign() const { return !m_callsign.isEmpty(); }
//! Has home base?
bool hasHomeBase() const { return !m_homebase.isEmpty(); }
//! Has valid home base?
bool hasValidHomeBase() const;
//! Real name + homebase
QString getRealNameAndHomeBase(const QString &separator = QString(" ")) const;