swift
textmessagelist.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_NETWORK_TEXTMESSAGELIST_H
7 #define SWIFT_MISC_NETWORK_TEXTMESSAGELIST_H
8 
9 #include <QList>
10 #include <QMetaType>
11 #include <QString>
12 
13 #include "misc/aviation/callsign.h"
14 #include "misc/collection.h"
16 #include "misc/pq/frequency.h"
17 #include "misc/sequence.h"
18 #include "misc/swiftmiscexport.h"
20 
21 SWIFT_DECLARE_SEQUENCE_MIXINS(swift::misc::network, CTextMessage, CTextMessageList)
22 
23 namespace swift::misc::network
24 {
25  class CTextMessage;
26 
29  public CSequence<CTextMessage>,
30  public ITimestampObjectList<CTextMessage, CTextMessageList>,
31  public mixin::MetaType<CTextMessageList>
32  {
33  public:
36 
39 
41  CTextMessageList(const QString &message, const aviation::CCallsign &recipientCallsign);
42 
44  CTextMessageList(const QString &message, const aviation::CCallsign &senderCallsign,
45  const aviation::CCallsign &recipientCallsign);
46 
48  CTextMessageList(const QString &message, const physical_quantities::CFrequency &frequency,
49  const aviation::CCallsign &senderCallsign = {});
50 
52  CTextMessageList(const CTextMessage &message);
53 
55  CTextMessageList(const QString &message, const QList<physical_quantities::CFrequency> &frequencies,
56  const aviation::CCallsign &fromCallsign = {});
57 
60 
62  CTextMessageList getPrivateMessages() const;
63 
65  bool containsPrivateMessages() const;
66 
68  CTextMessageList getRadioMessages() const;
69 
71  CTextMessageList getSupervisorMessages() const;
72 
74  bool containsRadioMessages() const;
75 
77  CTextMessageList containsSupervisorMessages() const;
78 
80  CTextMessageList findByFrequency(const physical_quantities::CFrequency &frequency) const;
81 
83  CTextMessageList findBySender(const swift::misc::aviation::CCallsign &sender) const;
84 
86  CTextMessageList findByRecipient(const swift::misc::aviation::CCallsign &recipient) const;
87 
89  CTextMessageList findByNotForRecipient(const swift::misc::aviation::CCallsign &recipient) const;
90 
92  void toggleSenderRecipients();
93 
95  int relayedToPrivateMessages();
96 
98  int removePrivateMessagesFromCallsign(const aviation::CCallsign &callsign);
99 
101  CTextMessageList withRelayedToPrivateMessages() const;
102 
104  CTextMessageList withRemovedPrivateMessagesFromCallsign(const aviation::CCallsign &callsign) const;
105 
107  void markAsSent();
108 
110  CTextMessageList markedAsSent();
111 
113  void addConsolidatedTextMessage(const CTextMessage &message);
114  };
115 } // namespace swift::misc::network
116 
117 Q_DECLARE_METATYPE(swift::misc::network::CTextMessageList)
119 
120 #endif // SWIFT_MISC_NETWORK_TEXTMESSAGELIST_H
Generic ordered container with value semantics.
Definition: collection.h:107
Generic sequential container with value semantics.
Definition: sequence.h:86
CSequence()=default
Default constructor.
List of objects with timestamp. Such objects should implement.
Value object encapsulating information of a callsign.
Definition: callsign.h:30
CRTP class template from which a derived class can inherit common methods dealing with the metatype o...
Definition: mixinmetatype.h:29
Value object encapsulating information of a text message.
Definition: textmessage.h:31
Value object encapsulating a list of text messages.
CTextMessageList(const QString &message, const QList< physical_quantities::CFrequency > &frequencies, const aviation::CCallsign &fromCallsign={})
Constructor, multi-frequency radio messages.
#define SWIFT_MISC_DECLARE_USING_MIXIN_METATYPE(DERIVED)
When a derived class and a base class both inherit from mixin::MetaType, the derived class uses this ...
#define SWIFT_DECLARE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template declaration of mixins for a CSequence subclass to be placed near the top of the hea...
Definition: sequence.h:62
#define SWIFT_MISC_EXPORT
Export a class or function from the library.