swift
Loading...
Searching...
No Matches
swift::misc::network::CUser Class Reference

Value object encapsulating information of a user. More...

#include <user.h>

Inheritance diagram for swift::misc::network::CUser:
[legend]

Public Types

enum  ColumnIndex {
  IndexEmail = CPropertyIndexRef::GlobalIndexCUser , IndexId , IndexIdInteger , IndexId7Digit ,
  IndexPassword , IndexRealName , IndexCallsign , IndexHomebase
}
 Properties by index. More...
Public Types inherited from swift::misc::CValueObject< CUser >
using base_type
 Base class.
Public Types inherited from swift::misc::CEmpty
using base_type = CEmpty
 Base class is alias of itself.
Public Types inherited from swift::misc::mixin::Index< CUser >
enum  ColumnIndex
 Base class enums. More...

Public Member Functions

 CUser ()=default
 Default constructor.
 CUser (const aviation::CCallsign &callsign)
 Constructor by callsign.
 CUser (const QString &id, const QString &realname, const aviation::CCallsign &callsign)
 Constructor.
 CUser (const QString &id, const QString &realname, const QString &email="", const QString &password="", const aviation::CCallsign &callsign={})
 Constructor.
const QString & getRealName () const
 Get full name.
void setRealName (const QString &realname)
 Set real name.
const QString & getPassword () const
 Get password.
void setPassword (const QString &pw)
 Set password.
bool isValid () const
 Valid user object?
bool isNull () const
 Null?
bool hasCredentials () const
 Valid credentials?
bool hasRealName () const
 Valid real name?
bool hasId () const
 Valid id?
bool hasValidVatsimId () const
 Has a valid VATSIM id?
bool hasCallsign () const
 Has associated callsign?
bool hasHomeBase () const
 Has home base?
bool hasValidHomeBase () const
 Has valid home base?
bool hasValidOrEmptyHomeBase () const
 Has valid or empty home base?
QString getRealNameAndHomeBase (const QString &separator=QString(" ")) const
 Real name + homebase.
QString getRealNameAndId () const
 Real name and id.
CStatusMessageList validate () const
 Validate, provide details about issues.
const QString & getEmail () const
 Get email.
void setEmail (const QString &email)
 Set email.
bool hasValidEmail () const
 Valid email?
const QString & getId () const
 Get id.
QString get7DigitId () const
 Numeric ids get a leading zeros if required.
int getIntegerId () const
 Id as integer if possible, otherwise -1.
bool hasNumericId () const
 Has a numeric id?
void setId (const QString &id)
 Set id.
const aviation::CAirportIcaoCode & getHomeBase () const
 Homebase.
void setHomeBase (const aviation::CAirportIcaoCode &homebase)
 Set homebase.
const aviation::CCallsign & getCallsign () const
 Get associated callsign.
bool setCallsign (const aviation::CCallsign &callsign)
 Set associated callsign.
CIcons::IconIndex toIcon () const
 As icon, not implemented by all classes.
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const CUser &compareValue) const
 Compare for index.
void synchronizeData (CUser &otherUser)
 This and another user exchange missing data, This user has priority and overrides first.
void updateMissingParts (const CUser &otherUser)
 Update missing parts in this object.
QString convertToQString (bool i18n=false) const
 Cast as QString.
Public Member Functions inherited from swift::misc::mixin::MetaType< CUser >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object.
QString getClassName () const
 Class name.
bool isA (int metaTypeId) const
 Returns true if this object is an instance of the class with the given meta type ID, or one of its subclasses.
Public Member Functions inherited from swift::misc::mixin::DBusByMetaClass< CUser >
void marshallToDbus (QDBusArgument &arg, Tags...) const
 Marshall without begin/endStructure, for when composed within another object.
void unmarshallFromDbus (const QDBusArgument &arg, Tags...)
 Unmarshall without begin/endStructure, for when composed within another object.
Public Member Functions inherited from swift::misc::mixin::DataStreamByMetaClass< CUser >
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream.
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream.
Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< CUser >
QJsonObject toJson () const
 Cast to JSON object.
QString toJsonString (QJsonDocument::JsonFormat format=QJsonDocument::Indented) const
 Convenience function JSON as string.
void convertFromJson (const QJsonObject &json)
 Assign from JSON object.
Public Member Functions inherited from swift::misc::mixin::String< CUser >
QString toQString (bool i18n=false) const
 Cast as QString.
std::string toStdString (bool i18n=false) const
 To std string.
QString stringForStreaming () const
 String for streaming operators.
Public Member Functions inherited from swift::misc::mixin::Index< CUser >
CPropertyIndexList apply (const CPropertyIndexVariantMap &indexMap, bool skipEqualValues=false)
 Update by variant map.
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const CUser &compareValue) const
 Compare for index.
bool equalsPropertyByIndex (const QVariant &compareValue, CPropertyIndexRef index) const
 Is given variant equal to value of property index?
Public Member Functions inherited from swift::misc::mixin::Icon< CUser >
CIcons::CIcons::StandardIconUnknown16 toIcon () const
 As icon, not implemented by all classes.

Static Public Member Functions

static bool isValidVatsimId (const QString &id)
 Valid VATSIM id.
static QString beautifyRealName (const QString &realName)
 Beautify real name, e.g. "JOE DoE" -> "Joe Doe";.
Static Public Member Functions inherited from swift::misc::mixin::MetaType< CUser >
static void registerMetadata ()
 Register metadata.
Static Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< CUser >
static DerivedObj fromJson (const QJsonObject &json)
 Get object from QJsonObject.
static DerivedObj fromJsonNoThrow (const QString &jsonString, bool acceptCacheJson, bool &success, QString &errMsg)
 Get object from JSON string.

Additional Inherited Members

Protected Member Functions inherited from swift::misc::CValueObject< CUser >
 CEmpty ()=default
 Inheriting constructors.
 CEmpty (const CEmpty &)=default
 Inheriting constructors.
 CValueObject ()=default
 Default constructor.
CValueObject & operator= (const CValueObject &)=default
 Copy assignment operator.
 ~CValueObject ()=default
 Destructor.
Protected Member Functions inherited from swift::misc::CEmpty
 CEmpty ()=default
 Protected default constructor.
 CEmpty (const CEmpty &)=default
 Protected copy constructor.
CEmpty & operator= (const CEmpty &)=default
 Protected copy assignment operator.
 ~CEmpty ()=default
 Non-virtual protected destructor.

Detailed Description

Value object encapsulating information of a user.

Definition at line 27 of file user.h.

Member Enumeration Documentation

◆ ColumnIndex

Properties by index.

Definition at line 33 of file user.h.

Constructor & Destructor Documentation

◆ CUser() [1/3]

swift::misc::network::CUser::CUser ( const aviation::CCallsign & callsign)

Constructor by callsign.

Definition at line 27 of file user.cpp.

◆ CUser() [2/3]

swift::misc::network::CUser::CUser ( const QString & id,
const QString & realname,
const aviation::CCallsign & callsign )

Constructor.

Definition at line 29 of file user.cpp.

◆ CUser() [3/3]

swift::misc::network::CUser::CUser ( const QString & id,
const QString & realname,
const QString & email = "",
const QString & password = "",
const aviation::CCallsign & callsign = {} )

Constructor.

Definition at line 36 of file user.cpp.

Member Function Documentation

◆ beautifyRealName()

QString swift::misc::network::CUser::beautifyRealName ( const QString & realName)
static

Beautify real name, e.g. "JOE DoE" -> "Joe Doe";.

Definition at line 259 of file user.cpp.

◆ comparePropertyByIndex()

int swift::misc::network::CUser::comparePropertyByIndex ( CPropertyIndexRef index,
const CUser & compareValue ) const

Compare for index.

Definition at line 359 of file user.cpp.

◆ convertToQString()

QString swift::misc::network::CUser::convertToQString ( bool i18n = false) const

Cast as QString.

Definition at line 82 of file user.cpp.

◆ get7DigitId()

QString swift::misc::network::CUser::get7DigitId ( ) const

Numeric ids get a leading zeros if required.

Definition at line 174 of file user.cpp.

◆ getCallsign()

const aviation::CCallsign & swift::misc::network::CUser::getCallsign ( ) const
inline

Get associated callsign.

Definition at line 140 of file user.h.

◆ getEmail()

const QString & swift::misc::network::CUser::getEmail ( ) const
inline

Get email.

Definition at line 110 of file user.h.

◆ getHomeBase()

const aviation::CAirportIcaoCode & swift::misc::network::CUser::getHomeBase ( ) const
inline

Homebase.

Definition at line 134 of file user.h.

◆ getId()

const QString & swift::misc::network::CUser::getId ( ) const
inline

Get id.

Definition at line 119 of file user.h.

◆ getIntegerId()

int swift::misc::network::CUser::getIntegerId ( ) const

Id as integer if possible, otherwise -1.

Definition at line 189 of file user.cpp.

◆ getPassword()

const QString & swift::misc::network::CUser::getPassword ( ) const
inline

Get password.

Definition at line 65 of file user.h.

◆ getRealName()

const QString & swift::misc::network::CUser::getRealName ( ) const
inline

Get full name.

Definition at line 59 of file user.h.

◆ getRealNameAndHomeBase()

QString swift::misc::network::CUser::getRealNameAndHomeBase ( const QString & separator = QString(" ")) const

Real name + homebase.

Definition at line 45 of file user.cpp.

◆ getRealNameAndId()

QString swift::misc::network::CUser::getRealNameAndId ( ) const

Real name and id.

Definition at line 58 of file user.cpp.

◆ hasCallsign()

bool swift::misc::network::CUser::hasCallsign ( ) const
inline

Has associated callsign?

Definition at line 89 of file user.h.

◆ hasCredentials()

bool swift::misc::network::CUser::hasCredentials ( ) const
inline

Valid credentials?

Definition at line 77 of file user.h.

◆ hasHomeBase()

bool swift::misc::network::CUser::hasHomeBase ( ) const
inline

Has home base?

Definition at line 92 of file user.h.

◆ hasId()

bool swift::misc::network::CUser::hasId ( ) const
inline

Valid id?

Definition at line 83 of file user.h.

◆ hasNumericId()

bool swift::misc::network::CUser::hasNumericId ( ) const

Has a numeric id?

Definition at line 202 of file user.cpp.

◆ hasRealName()

bool swift::misc::network::CUser::hasRealName ( ) const
inline

Valid real name?

Definition at line 80 of file user.h.

◆ hasValidEmail()

bool swift::misc::network::CUser::hasValidEmail ( ) const
inline

Valid email?

Definition at line 116 of file user.h.

◆ hasValidHomeBase()

bool swift::misc::network::CUser::hasValidHomeBase ( ) const

Has valid home base?

Definition at line 151 of file user.cpp.

◆ hasValidOrEmptyHomeBase()

bool swift::misc::network::CUser::hasValidOrEmptyHomeBase ( ) const

Has valid or empty home base?

Definition at line 153 of file user.cpp.

◆ hasValidVatsimId()

bool swift::misc::network::CUser::hasValidVatsimId ( ) const
inline

Has a valid VATSIM id?

Definition at line 86 of file user.h.

◆ isNull()

bool swift::misc::network::CUser::isNull ( ) const
inline

Null?

Definition at line 74 of file user.h.

◆ isValid()

bool swift::misc::network::CUser::isValid ( ) const
inline

Valid user object?

Definition at line 71 of file user.h.

◆ isValidVatsimId()

bool swift::misc::network::CUser::isValidVatsimId ( const QString & id)
static

Valid VATSIM id.

Definition at line 245 of file user.cpp.

◆ propertyByIndex()

QVariant swift::misc::network::CUser::propertyByIndex ( CPropertyIndexRef index) const

Property by index.

Definition at line 316 of file user.cpp.

◆ setCallsign()

bool swift::misc::network::CUser::setCallsign ( const aviation::CCallsign & callsign)

Set associated callsign.

Definition at line 71 of file user.cpp.

◆ setEmail()

void swift::misc::network::CUser::setEmail ( const QString & email)

Set email.

Definition at line 386 of file user.cpp.

◆ setHomeBase()

void swift::misc::network::CUser::setHomeBase ( const aviation::CAirportIcaoCode & homebase)
inline

Set homebase.

Definition at line 137 of file user.h.

◆ setId()

void swift::misc::network::CUser::setId ( const QString & id)

Set id.

Definition at line 388 of file user.cpp.

◆ setPassword()

void swift::misc::network::CUser::setPassword ( const QString & pw)

Set password.

Definition at line 384 of file user.cpp.

◆ setPropertyByIndex()

void swift::misc::network::CUser::setPropertyByIndex ( CPropertyIndexRef index,
const QVariant & variant )

Set property by index.

Definition at line 337 of file user.cpp.

◆ setRealName()

void swift::misc::network::CUser::setRealName ( const QString & realname)

Set real name.

Definition at line 122 of file user.cpp.

◆ synchronizeData()

void swift::misc::network::CUser::synchronizeData ( CUser & otherUser)

This and another user exchange missing data, This user has priority and overrides first.

Definition at line 235 of file user.cpp.

◆ toIcon()

CIcons::IconIndex swift::misc::network::CUser::toIcon ( ) const
inline

As icon, not implemented by all classes.

Definition at line 146 of file user.h.

◆ updateMissingParts()

void swift::misc::network::CUser::updateMissingParts ( const CUser & otherUser)

Update missing parts in this object.

Definition at line 211 of file user.cpp.

◆ validate()

CStatusMessageList swift::misc::network::CUser::validate ( ) const

Validate, provide details about issues.

Definition at line 155 of file user.cpp.


The documentation for this class was generated from the following files: