swift
Public Types | Public Member Functions | Static Public Member Functions | List of all members
swift::misc::network::CServer Class Reference

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

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

Public Types

enum  ColumnIndex {
  IndexName = CPropertyIndexRef::GlobalIndexCServer , IndexDescription , IndexAddress , IndexPort ,
  IndexUser , IndexFsdSetup , IndexEcosystem , IndexIsAcceptingConnections ,
  IndexServerType , IndexServerTypeAsString
}
 Properties by index.
 
enum  ServerType {
  Unspecified , FSDServerVatsim , FSDServer , VoiceServerVatsim ,
  VoiceServer , WebService
}
 Server Type.
 
- Public Types inherited from swift::misc::CValueObject< CServer >
using base_type = CEmpty
 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< Derived >
enum  ColumnIndex { IndexPixmap = 10 , IndexIcon , IndexString }
 Base class enums.
 
- Public Types inherited from swift::misc::ITimestampBased
enum  ColumnIndex {
  IndexUtcTimestamp = CPropertyIndexRef::GlobalIndexITimestampBased , IndexUtcTimestampFormattedYmdhms , IndexUtcTimestampFormattedYmdhmsz , IndexUtcTimestampFormattedMdhms ,
  IndexUtcTimestampFormattedMdhmsz , IndexUtcTimestampFormattedDhms , IndexUtcTimestampFormattedHms , IndexUtcTimestampFormattedHm ,
  IndexMSecsSinceEpoch
}
 Properties by index.
 

Public Member Functions

 CServer ()
 Default constructor.
 
 CServer (const QString &name, const QString &description, const QString &address, int port, const CUser &user, const CFsdSetup &fsdSetup, const CEcosystem &ecosytem, ServerType serverType, bool isAcceptingConnections=true)
 Constructor.
 
 CServer (const QString &address, int port, const CUser &user)
 Constructor (minimal for testing)
 
 CServer (const CEcosystem &ecosystem)
 Constructor by ecosystem.
 
 CServer (ServerType serverType)
 Constructor by server type.
 
const QString & getAddress () const
 Get address.
 
void setAddress (const QString &address)
 Set address (e.g. myserver.foo.com)
 
const CUsergetUser () const
 Get user.
 
void setUser (const CUser &user)
 Set user.
 
const QString & getName () const
 Get name.
 
bool hasName () const
 Has name?
 
void setName (const QString &name)
 Set name.
 
bool matchesName (const QString &name) const
 Matches server name?
 
bool matchesAddressPort (const CServer &server) const
 Same address and port?
 
bool matchesAddress (const QString &address) const
 Same address?
 
const QString & getDescription () const
 Get description.
 
void setDescription (const QString &description)
 Set description.
 
int getPort () const
 Get port.
 
void setPort (int port)
 Set port.
 
const CEcosystemgetEcosystem () const
 Get the ecosystem.
 
bool setEcosystem (const CEcosystem &ecosystem)
 Set the ecosystem.
 
bool isAcceptingConnections () const
 Server is accepting connections (allows to disable server temporarily or generally)
 
void setIsAcceptingConnections (bool value)
 Set whether server is accepting connections (allows to disable server temporarily or generally)
 
bool isValidForLogin () const
 Is valid for login?
 
bool hasAddressAndPort () const
 Address and port?
 
const CFsdSetupgetFsdSetup () const
 Get FSD setup.
 
void setFsdSetup (const CFsdSetup &setup)
 Set FSD setup.
 
void addSendReceiveDetails (CFsdSetup::SendReceiveDetails sendReceive)
 Add send / receive details.
 
void removeSendReceiveDetails (CFsdSetup::SendReceiveDetails sendReceive)
 Remove send / receive details.
 
bool isFsdServer () const
 A FSD server?
 
bool setServerType (ServerType serverType)
 Set server type.
 
ServerType getServerType () const
 Get server type.
 
bool hasUnspecifiedServerType () const
 Unspecified?
 
const QString & getServerTypeAsString () const
 Get server type as string.
 
QDateTime getConnectedSince () const
 Connected since.
 
void setConnectedSinceNow ()
 Mark as connected since now.
 
void markAsDisconnected ()
 Mark as diconnected.
 
bool isConnected () const
 Is connected?
 
bool isNull () const
 NULL?
 
CStatusMessageList validate () const
 Validate, provide details about issues.
 
QString getServerSessionId (bool onlyConnected) const
 Identifying a session, if not connected empty.
 
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index. More...
 
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index. More...
 
int comparePropertyByIndex (CPropertyIndexRef index, const CServer &compareValue) const
 Compare for index. More...
 
QString convertToQString (bool i18n=false) const
 Cast as QString. More...
 
- Public Member Functions inherited from swift::misc::mixin::MetaType< Derived >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object. More...
 
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< Derived, Tags >
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< Derived >
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< Derived >
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.
 
void convertFromJson (const QString &jsonString, bool acceptCacheFormat=false)
 Assign from JSON object string.
 
- Public Member Functions inherited from swift::misc::mixin::String< Derived >
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< Derived >
CPropertyIndexList apply (const CPropertyIndexVariantMap &indexMap, bool skipEqualValues=false)
 Update by variant map. More...
 
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
 
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
 
int comparePropertyByIndex (CPropertyIndexRef index, const Derived &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< Derived, IconIndex >
CIcons::IconIndex toIcon () const
 As icon, not implemented by all classes.
 
- Public Member Functions inherited from swift::misc::ITimestampBased
QDateTime getUtcTimestamp () const
 Get timestamp.
 
qint64 getMSecsSinceEpoch () const
 Timestamp as ms value.
 
qint64 getTimeDifferenceMs (qint64 compareTime) const
 Time difference in ms.
 
qint64 getTimeDifferenceAbsMs (qint64 compareTime) const
 Time difference in ms.
 
qint64 getTimeDifferenceToNowMs () const
 Time difference to now.
 
qint64 getTimeDifferenceMs (const ITimestampBased &compare) const
 Time difference in ms.
 
qint64 getAbsTimeDifferenceMs (qint64 compareTime) const
 Time difference in ms.
 
qint64 getAbsTimeDifferenceMs (const ITimestampBased &compare) const
 Time difference in ms.
 
void setTimestampToNull ()
 Set to null.
 
void setMSecsSinceEpoch (qint64 mSecsSinceEpoch)
 Timestamp as ms value.
 
void setByYearMonthDayHourMinute (const QString &yyyyMMddhhmmss)
 Set by value such as "20141003231045".
 
void setUtcTimestamp (const QDateTime &timestamp)
 Set timestamp.
 
bool isNewerThan (const ITimestampBased &otherTimestampObj) const
 Is this newer than other?
 
bool isNewerThan (qint64 mSecsSinceEpoch) const
 Is newer than epoch value?
 
bool isOlderThan (const ITimestampBased &otherTimestampObj) const
 Is this older than other?
 
bool isOlderThan (qint64 mSecsSinceEpoch) const
 Is this older than other?
 
bool isOlderThanNowMinusOffset (int offsetMs) const
 Older than now-offset.
 
bool isSame (const ITimestampBased &otherTimestampObj) const
 Same timestamp.
 
qint64 msecsTo (const ITimestampBased &otherTimestampObj) const
 Time difference.
 
qint64 absMsecsTo (const ITimestampBased &otherTimestampObj) const
 Time difference.
 
qint64 msecsToNow () const
 Milliseconds to now.
 
void setCurrentUtcTime ()
 Set the current time as timestamp.
 
void addMsecs (qint64 ms)
 Add the given number of milliseconds to the timestamp.
 
QString getFormattedUtcTimestampHms () const
 As hh:mm:ss.
 
QString getFormattedUtcTimestampHmsz () const
 As hh:mm:ss.zzz.
 
QString getFormattedUtcTimestampHm () const
 As hh:mm.
 
QString getFormattedUtcTimestampDhms () const
 As dd HH mm ss.
 
QString getFormattedUtcTimestampMdhms () const
 As MM dd HH mm ss.
 
QString getFormattedUtcTimestampMdhmsz () const
 As MM dd HH mm ss.zzz.
 
QString getFormattedUtcTimestampYmdhms () const
 As yyyy MM dd HH mm ss.
 
QString getFormattedUtcTimestampYmdhmsz () const
 As yyyy MM dd HH mm ss.zzz.
 
bool hasValidTimestamp () const
 Valid timestamp?
 

Static Public Member Functions

static const QList< int > & allServerTypes ()
 Allows to iterate over all ServerType.
 
static const QString & serverTypeToString (ServerType server)
 Enum to string.
 
static const CServerfscFsdServer ()
 FSC server.
 
static const CServeresTowerView ()
 ES tower server.
 
- Static Public Member Functions inherited from swift::misc::mixin::MetaType< Derived >
static void registerMetadata ()
 Register metadata.
 
- Static Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< Derived >
template<class DerivedObj = Derived>
static DerivedObj fromJson (const QJsonObject &json)
 Get object from QJsonObject.
 
template<class DerivedObj = Derived>
static DerivedObj fromJson (const QString &jsonString, bool acceptCacheJson=false)
 Get object from JSON string.
 
template<class DerivedObj = Derived>
static DerivedObj fromJsonNoThrow (const QString &jsonString, bool acceptCacheJson, bool &success, QString &errMsg)
 Get object from JSON string.
 
- Static Public Member Functions inherited from swift::misc::ITimestampBased
static bool isAnyTimestampIndex (int index)
 Any of the timestamp indexes.
 
static bool canHandleIndex (CPropertyIndexRef index)
 Can given index be handled.
 

Additional Inherited Members

- Protected Member Functions inherited from swift::misc::CValueObject< CServer >
 CValueObject ()=default
 Default constructor.
 
 CValueObject (const CValueObject &)=default
 Copy constructor.
 
CValueObjectoperator= (const CValueObject &)=default
 Copy assignment operator.
 
 ~CValueObject ()=default
 Destructor.
 
 CEmpty ()=default
 Inheriting constructors.
 
 CEmpty (const CEmpty &)=default
 Inheriting constructors.
 
- Protected Member Functions inherited from swift::misc::CEmpty
 CEmpty ()=default
 Protected default constructor.
 
 CEmpty (const CEmpty &)=default
 Protected copy constructor.
 
CEmptyoperator= (const CEmpty &)=default
 Protected copy assignment operator.
 
 ~CEmpty ()=default
 Non-virtual protected destructor.
 
- Protected Member Functions inherited from swift::misc::ITimestampBased
 ITimestampBased ()
 Constructor.
 
 ITimestampBased (qint64 msSincePoch)
 Constructor.
 
 ITimestampBased (const QDateTime &timestamp)
 Constructor.
 
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index. More...
 
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index. More...
 
int comparePropertyByIndex (CPropertyIndexRef index, const ITimestampBased &compareValue) const
 Compare for index. More...
 
void updateMissingParts (const ITimestampBased &other)
 Update missing parts.
 
- Protected Attributes inherited from swift::misc::ITimestampBased
qint64 m_timestampMSecsSinceEpoch = -1
 timestamp value
 

Detailed Description

Value object encapsulating information of a server.

Definition at line 27 of file server.h.

Member Function Documentation

◆ comparePropertyByIndex()

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

Compare for index.

Definition at line 216 of file server.cpp.

◆ convertToQString()

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

Cast as QString.

Definition at line 44 of file server.cpp.

◆ propertyByIndex()

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

Property by index.

Definition at line 165 of file server.cpp.

◆ setPropertyByIndex()

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

Set property by index.

Definition at line 187 of file server.cpp.


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