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

Value object encapsulating information of a text message. More...

#include <textmessage.h>

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

Public Types

enum  ColumnIndex { IndexSenderCallsign = CPropertyIndexRef::GlobalIndexCTextMessage , IndexRecipientCallsign , IndexRecipientCallsignOrFrequency , IndexMessage }
 Properties by index. More...
Public Types inherited from swift::misc::CValueObject< CTextMessage >
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< CTextMessage >
enum  ColumnIndex
 Base class enums. More...
Public Types inherited from swift::misc::ITimestampBased
enum  ColumnIndex {
  IndexUtcTimestamp = CPropertyIndexRef::GlobalIndexITimestampBased , IndexUtcTimestampFormattedYmdhms , IndexUtcTimestampFormattedYmdhmsz , IndexUtcTimestampFormattedMdhms ,
  IndexUtcTimestampFormattedMdhmsz , IndexUtcTimestampFormattedDhms , IndexUtcTimestampFormattedHms , IndexUtcTimestampFormattedHm ,
  IndexMSecsSinceEpoch
}
 Properties by index. More...

Public Member Functions

 CTextMessage ()=default
 Default constructor.
 CTextMessage (const QString &message, const physical_quantities::CFrequency &frequency, const aviation::CCallsign &senderCallsign={})
 Constructor, radio message.
 CTextMessage (const QString &message, const aviation::CCallsign &senderCallsign, const aviation::CCallsign &recipientCallsign={})
 Constructor, private message.
const aviation::CCallsign & getSenderCallsign () const
 Get callsign (from).
void setSenderCallsign (const aviation::CCallsign &callsign)
 Set callsign (from).
const aviation::CCallsign & getRecipientCallsign () const
 Get callsign (to).
void setRecipientCallsign (const aviation::CCallsign &callsign)
 Set callsign (recipient).
QString getRecipientCallsignOrFrequency () const
 Get recipient or frequency.
bool isSendToFrequency (const physical_quantities::CFrequency &frequency) const
 Send to particular frequency?
bool isSendToUnicom () const
 Send to UNICOM?
bool hasValidRecipient () const
 Valid receviver?
const QString & getMessage () const
 Get message.
bool mentionsCallsign (const aviation::CCallsign &callsign) const
 Is the callsign given mentioned in that message.
QString getAsciiOnlyMessage () const
 Get ASCII only message.
QString getHtmlEncodedMessage () const
 Get HTML escaped message.
bool isEmpty () const
 Empty message.
void setMessage (const QString &message)
 Set message.
const physical_quantities::CFrequency & getFrequency () const
 Get frequency.
void setFrequency (const physical_quantities::CFrequency &frequency)
 Set frequency.
bool isPrivateMessage () const
 Is private message?
bool isRadioMessage () const
 Is radio message?
bool isServerMessage () const
 Initial message of server?
bool isBroadcastMessage () const
 Is this a broadcast message.
bool isWallopMessage () const
 Is this a message send via .wallop.
QString asString (bool withSender, bool withRecipient, const QString &separator=", ") const
 Whole message as formatted string. Used to display message in a console window.
CStatusMessage asStatusMessage (bool withSender, bool withRecipient, const QString &separator=", ") const
 Whole message as swift::misc::CStatusMessage. Used to display message in logs, or any other situation where a CStatusMessage is required.
QString asHtmlSummary (const QString &separator="<br>") const
 Summary HTML code.
void toggleSenderRecipient ()
 Toggle sender receiver, can be used to ping my own message.
bool isSelcalMessage () const
 Is this a text message encapsulating a SELCAL.
bool isSelcalMessageFor (const QString &selcal) const
 Is this a text message encapsulating a SELCAL for given code?
bool isSupervisorMessage () const
 Supervisor message?
bool wasSent () const
 Was sent?
void markAsSent ()
 Mark as sent.
bool isRelayedMessage () const
 Is relayed message.
void markAsRelayedMessage ()
 Mark as relayed message.
void markAsBroadcastMessage ()
 Mark as broadcast message.
void makeRelayedMessage (const aviation::CCallsign &partnerCallsign)
 Mark as relayed and keep original sender.
bool relayedMessageToPrivateMessage ()
 Turn relayed message into private message.
bool canBeAppended (const CTextMessage &textMessage) const
 Can another message be appended.
bool appendIfPossible (const CTextMessage &textMessage)
 Append if possible.
QString getSelcalCode () const
 Get SELCAL code (if applicable, e.g. ABCD), otherwise "".
CIcons::IconIndex toIcon () const
 As icon, not implement by all classes.
QPixmap toPixmap () const
 As pixmap, required for most GUI views.
QVariant propertyByIndex (swift::misc::CPropertyIndexRef index) const
 Property by index.
void setPropertyByIndex (swift::misc::CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const CTextMessage &compareValue) const
 Compare for index.
QString convertToQString (bool i18n=false) const
 Cast as QString.
Public Member Functions inherited from swift::misc::mixin::MetaType< CTextMessage >
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< CTextMessage >
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< CTextMessage >
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< CTextMessage >
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< CTextMessage >
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< CTextMessage >
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 CTextMessage &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< CTextMessage >
CIcons::CIcons::StandardIconUnknown16 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 QString & swiftRelayMessage ()
 swift relay message marker
Static Public Member Functions inherited from swift::misc::mixin::MetaType< CTextMessage >
static void registerMetadata ()
 Register metadata.
Static Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< CTextMessage >
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.
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< CTextMessage >
 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.
Protected Member Functions inherited from swift::misc::ITimestampBased
 ITimestampBased ()=default
 Constructor.
 ITimestampBased (qint64 msSincePoch)
 Constructor.
 ITimestampBased (const QDateTime &timestamp)
 Constructor.
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const ITimestampBased &compareValue) const
 Compare for index.
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 text message.

Definition at line 30 of file textmessage.h.

Member Enumeration Documentation

◆ ColumnIndex

Properties by index.

Definition at line 34 of file textmessage.h.

Constructor & Destructor Documentation

◆ CTextMessage() [1/2]

swift::misc::network::CTextMessage::CTextMessage ( const QString & message,
const physical_quantities::CFrequency & frequency,
const aviation::CCallsign & senderCallsign = {} )

Constructor, radio message.

Definition at line 24 of file textmessage.cpp.

◆ CTextMessage() [2/2]

swift::misc::network::CTextMessage::CTextMessage ( const QString & message,
const aviation::CCallsign & senderCallsign,
const aviation::CCallsign & recipientCallsign = {} )

Constructor, private message.

Definition at line 31 of file textmessage.cpp.

Member Function Documentation

◆ appendIfPossible()

bool swift::misc::network::CTextMessage::appendIfPossible ( const CTextMessage & textMessage)

Append if possible.

Definition at line 152 of file textmessage.cpp.

◆ asHtmlSummary()

QString swift::misc::network::CTextMessage::asHtmlSummary ( const QString & separator = "<br>") const

Summary HTML code.

Definition at line 311 of file textmessage.cpp.

◆ asStatusMessage()

CStatusMessage swift::misc::network::CTextMessage::asStatusMessage ( bool withSender,
bool withRecipient,
const QString & separator = ", " ) const

Whole message as swift::misc::CStatusMessage. Used to display message in logs, or any other situation where a CStatusMessage is required.

Parameters
withSenderinclude sender information in string?
withRecipientinclude recipient information in string?
separatorvalues separated by given value

Definition at line 305 of file textmessage.cpp.

◆ asString()

QString swift::misc::network::CTextMessage::asString ( bool withSender,
bool withRecipient,
const QString & separator = ", " ) const

Whole message as formatted string. Used to display message in a console window.

Parameters
withSenderinclude sender information in string?
withRecipientinclude recipient information in string?
separatorvalues separated by given value

Definition at line 259 of file textmessage.cpp.

◆ canBeAppended()

bool swift::misc::network::CTextMessage::canBeAppended ( const CTextMessage & textMessage) const

Can another message be appended.

Definition at line 131 of file textmessage.cpp.

◆ comparePropertyByIndex()

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

Compare for index.

Definition at line 409 of file textmessage.cpp.

◆ convertToQString()

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

Cast as QString.

Definition at line 38 of file textmessage.cpp.

◆ getAsciiOnlyMessage()

QString swift::misc::network::CTextMessage::getAsciiOnlyMessage ( ) const

Get ASCII only message.

Definition at line 215 of file textmessage.cpp.

◆ getFrequency()

const physical_quantities::CFrequency & swift::misc::network::CTextMessage::getFrequency ( ) const
inline

Get frequency.

Definition at line 96 of file textmessage.h.

◆ getHtmlEncodedMessage()

QString swift::misc::network::CTextMessage::getHtmlEncodedMessage ( ) const

Get HTML escaped message.

Definition at line 224 of file textmessage.cpp.

◆ getMessage()

const QString & swift::misc::network::CTextMessage::getMessage ( ) const
inline

Get message.

Definition at line 78 of file textmessage.h.

◆ getRecipientCallsign()

const aviation::CCallsign & swift::misc::network::CTextMessage::getRecipientCallsign ( ) const
inline

Get callsign (to).

Definition at line 60 of file textmessage.h.

◆ getRecipientCallsignOrFrequency()

QString swift::misc::network::CTextMessage::getRecipientCallsignOrFrequency ( ) const

Get recipient or frequency.

Definition at line 166 of file textmessage.cpp.

◆ getSelcalCode()

QString swift::misc::network::CTextMessage::getSelcalCode ( ) const

Get SELCAL code (if applicable, e.g. ABCD), otherwise "".

Definition at line 342 of file textmessage.cpp.

◆ getSenderCallsign()

const aviation::CCallsign & swift::misc::network::CTextMessage::getSenderCallsign ( ) const
inline

Get callsign (from).

Definition at line 54 of file textmessage.h.

◆ hasValidRecipient()

bool swift::misc::network::CTextMessage::hasValidRecipient ( ) const

Valid receviver?

Definition at line 193 of file textmessage.cpp.

◆ isBroadcastMessage()

bool swift::misc::network::CTextMessage::isBroadcastMessage ( ) const

Is this a broadcast message.

Definition at line 247 of file textmessage.cpp.

◆ isEmpty()

bool swift::misc::network::CTextMessage::isEmpty ( ) const
inline

Empty message.

Definition at line 90 of file textmessage.h.

◆ isPrivateMessage()

bool swift::misc::network::CTextMessage::isPrivateMessage ( ) const

Is private message?

Definition at line 53 of file textmessage.cpp.

◆ isRadioMessage()

bool swift::misc::network::CTextMessage::isRadioMessage ( ) const

Is radio message?

Definition at line 235 of file textmessage.cpp.

◆ isRelayedMessage()

bool swift::misc::network::CTextMessage::isRelayedMessage ( ) const

Is relayed message.

Definition at line 79 of file textmessage.cpp.

◆ isSelcalMessage()

bool swift::misc::network::CTextMessage::isSelcalMessage ( ) const

Is this a text message encapsulating a SELCAL.

See also
http://forums.vatsim.net/viewtopic.php?f=8&t=63467

Definition at line 318 of file textmessage.cpp.

◆ isSelcalMessageFor()

bool swift::misc::network::CTextMessage::isSelcalMessageFor ( const QString & selcal) const

Is this a text message encapsulating a SELCAL for given code?

Definition at line 336 of file textmessage.cpp.

◆ isSendToFrequency()

bool swift::misc::network::CTextMessage::isSendToFrequency ( const physical_quantities::CFrequency & frequency) const

Send to particular frequency?

Definition at line 179 of file textmessage.cpp.

◆ isSendToUnicom()

bool swift::misc::network::CTextMessage::isSendToUnicom ( ) const

Send to UNICOM?

Definition at line 188 of file textmessage.cpp.

◆ isServerMessage()

bool swift::misc::network::CTextMessage::isServerMessage ( ) const

Initial message of server?

Definition at line 237 of file textmessage.cpp.

◆ isSupervisorMessage()

bool swift::misc::network::CTextMessage::isSupervisorMessage ( ) const

Supervisor message?

Definition at line 58 of file textmessage.cpp.

◆ isWallopMessage()

bool swift::misc::network::CTextMessage::isWallopMessage ( ) const

Is this a message send via .wallop.

Definition at line 253 of file textmessage.cpp.

◆ makeRelayedMessage()

void swift::misc::network::CTextMessage::makeRelayedMessage ( const aviation::CCallsign & partnerCallsign)

Mark as relayed and keep original sender.

Definition at line 86 of file textmessage.cpp.

◆ markAsBroadcastMessage()

void swift::misc::network::CTextMessage::markAsBroadcastMessage ( )

Mark as broadcast message.

Definition at line 84 of file textmessage.cpp.

◆ markAsRelayedMessage()

void swift::misc::network::CTextMessage::markAsRelayedMessage ( )
inline

Mark as relayed message.

Definition at line 156 of file textmessage.h.

◆ markAsSent()

void swift::misc::network::CTextMessage::markAsSent ( )

Mark as sent.

Remarks
also sets current timestamp if there is no valid timestamp

Definition at line 70 of file textmessage.cpp.

◆ mentionsCallsign()

bool swift::misc::network::CTextMessage::mentionsCallsign ( const aviation::CCallsign & callsign) const

Is the callsign given mentioned in that message.

Definition at line 202 of file textmessage.cpp.

◆ propertyByIndex()

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

Property by index.

Definition at line 364 of file textmessage.cpp.

◆ relayedMessageToPrivateMessage()

bool swift::misc::network::CTextMessage::relayedMessageToPrivateMessage ( )

Turn relayed message into private message.

Definition at line 102 of file textmessage.cpp.

◆ setFrequency()

void swift::misc::network::CTextMessage::setFrequency ( const physical_quantities::CFrequency & frequency)
inline

Set frequency.

Definition at line 99 of file textmessage.h.

◆ setMessage()

void swift::misc::network::CTextMessage::setMessage ( const QString & message)

Set message.

Definition at line 233 of file textmessage.cpp.

◆ setPropertyByIndex()

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

Set property by index.

Definition at line 386 of file textmessage.cpp.

◆ setRecipientCallsign()

void swift::misc::network::CTextMessage::setRecipientCallsign ( const aviation::CCallsign & callsign)
inline

Set callsign (recipient).

Definition at line 63 of file textmessage.h.

◆ setSenderCallsign()

void swift::misc::network::CTextMessage::setSenderCallsign ( const aviation::CCallsign & callsign)
inline

Set callsign (from).

Definition at line 57 of file textmessage.h.

◆ swiftRelayMessage()

const QString & swift::misc::network::CTextMessage::swiftRelayMessage ( )
static

swift relay message marker

Definition at line 47 of file textmessage.cpp.

◆ toggleSenderRecipient()

void swift::misc::network::CTextMessage::toggleSenderRecipient ( )

Toggle sender receiver, can be used to ping my own message.

Definition at line 316 of file textmessage.cpp.

◆ toIcon()

CIcons::IconIndex swift::misc::network::CTextMessage::toIcon ( ) const

As icon, not implement by all classes.

Definition at line 360 of file textmessage.cpp.

◆ toPixmap()

QPixmap swift::misc::network::CTextMessage::toPixmap ( ) const

As pixmap, required for most GUI views.

Definition at line 362 of file textmessage.cpp.

◆ wasSent()

bool swift::misc::network::CTextMessage::wasSent ( ) const
inline

Was sent?

Definition at line 146 of file textmessage.h.


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