11 using namespace swift::misc::physical_quantities;
12 using namespace swift::misc::aviation;
16 namespace swift::misc::network
19 CTextMessageList::CTextMessageList() {}
21 CTextMessageList::CTextMessageList(
const QString &message,
const CCallsign &recipientCallsign)
27 CTextMessageList::CTextMessageList(
const QString &message,
const CCallsign &fromCallsign,
34 CTextMessageList::CTextMessageList(
const QString &message,
const CFrequency &frequency,
41 CTextMessageList::CTextMessageList(
const CTextMessage &message) { this->push_back(message); }
43 CTextMessageList::CTextMessageList(
const QString &message,
const QList<CFrequency> &frequencies,
46 if (frequencies.isEmpty())
return;
47 for (
const CFrequency &frequency : frequencies)
101 if (recipient.
isEmpty()) {
return result; }
112 if (this->
isEmpty()) {
return; }
118 if (this->
isEmpty()) {
return 0; }
130 if (this->
isEmpty()) {
return 0; }
132 const int c = this->
size() - r.
size();
133 if (c < 1) {
return 0; }
140 if (this->
isEmpty()) {
return {}; }
148 if (this->
isEmpty()) {
return {}; }
149 if (callsign.
isEmpty()) {
return *
this; }
166 if (this->
isEmpty()) {
return {}; }
174 if (message.
isEmpty()) {
return; }
bool contains(const T &object) const
Return true if there is an element equal to given object. Uses the most efficient implementation avai...
size_type size() const
Returns number of elements in the sequence.
iterator begin()
Returns iterator at the beginning of the sequence.
CSequence findBy(Predicate p) const
Return a copy containing only those elements for which a given predicate returns true.
void push_back(const T &value)
Appends an element at the end of the sequence.
bool isEmpty() const
Synonym for empty.
iterator end()
Returns iterator one past the end of the sequence.
Value object encapsulating information of a callsign.
bool isEmpty() const
Is empty?
Value object encapsulating information of a text message.
void markAsSent()
Mark as sent.
bool relayedMessageToPrivateMessage()
Turn relayed message into private message.
bool isPrivateMessage() const
Is private message?
bool isEmpty() const
Empty message.
const aviation::CCallsign & getSenderCallsign() const
Get callsign (from)
const aviation::CCallsign & getRecipientCallsign() const
Get callsign (to)
void toggleSenderRecipient()
Toggle sender receiver, can be used to ping my own message.
bool isRadioMessage() const
Is radio message?
const physical_quantities::CFrequency & getFrequency() const
Get frequency.
bool appendIfPossible(const CTextMessage &textMessage)
Append if possible.
bool isSupervisorMessage() const
Supervisor message?
Value object encapsulating a list of text messages.
int removePrivateMessagesFromCallsign(const aviation::CCallsign &callsign)
Remove private messages from callsign.
CTextMessageList withRemovedPrivateMessagesFromCallsign(const aviation::CCallsign &callsign) const
With removed private messages from callsign.
CTextMessageList containsSupervisorMessages() const
Contains supervisor message.
void addConsolidatedTextMessage(const CTextMessage &message)
Add a text message, but append it to an existing message if possible.
int relayedToPrivateMessages()
Turn relayed into normal private messages.
void markAsSent()
Mark all messages as sent.
bool containsPrivateMessages() const
Contains private messages?
CTextMessageList findByNotForRecipient(const swift::misc::aviation::CCallsign &recipient) const
Find by recipient is NOT addressed.
CTextMessageList findBySender(const swift::misc::aviation::CCallsign &sender) const
Find by sender.
CTextMessageList findByFrequency(const physical_quantities::CFrequency &frequency) const
Find by frequency.
bool containsRadioMessages() const
Contains radio messages?
CTextMessageList getPrivateMessages() const
Private messages.
CTextMessageList getRadioMessages() const
Public messages.
CTextMessageList getSupervisorMessages() const
Supervisor messages.
void toggleSenderRecipients()
Toggle all sender <-> recipients.
CTextMessageList withRelayedToPrivateMessages() const
List with relayed messages (if any) as private messages.
CTextMessageList findByRecipient(const swift::misc::aviation::CCallsign &recipient) const
Find by recipient.
CTextMessageList markedAsSent()
Marked as sent.
#define SWIFT_DEFINE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template definition of mixins for a CSequence subclass.