swift
rawfsdmessage.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2018 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_RAWFSDMESSAGE_H
7 #define SWIFT_MISC_NETWORK_RAWFSDMESSAGE_H
8 
9 #include <QDateTime>
10 #include <QMetaType>
11 #include <QString>
12 
13 #include "misc/metaclass.h"
14 #include "misc/propertyindexref.h"
15 #include "misc/swiftmiscexport.h"
16 #include "misc/timestampbased.h"
17 #include "misc/valueobject.h"
18 
19 SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::network, CRawFsdMessage)
20 
21 namespace swift::misc::network
22 {
24  class SWIFT_MISC_EXPORT CRawFsdMessage : public CValueObject<CRawFsdMessage>, public ITimestampBased
25  {
26  public:
29  {
30  IndexRawMessage = CPropertyIndexRef::GlobalIndexCRawFsdMessage,
31  };
32 
34  CRawFsdMessage() = default;
35 
37  CRawFsdMessage(const QString &rawMessage);
38 
40  const QString &getRawMessage() const { return m_rawMessage; }
41 
43  void setRawMessage(const QString &rawMessage) { m_rawMessage = rawMessage; }
44 
46  bool isPacketType(const QString &type) const;
47 
49  bool containsString(const QString &str) const;
50 
52  static const QStringList &getAllPacketTypes();
53 
55  QVariant propertyByIndex(CPropertyIndexRef index) const;
56 
58  void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
59 
61  QString convertToQString(bool i18n = false) const;
62 
63  private:
64  QString m_rawMessage;
65 
68  SWIFT_METAMEMBER(rawMessage),
69  SWIFT_METAMEMBER(timestampMSecsSinceEpoch));
70  };
71 } // namespace swift::misc::network
72 
73 Q_DECLARE_METATYPE(swift::misc::network::CRawFsdMessage)
74 
75 #endif // SWIFT_MISC_NETWORK_RAWFSDMESSAGE_H
Non-owning reference to a CPropertyIndex with a subset of its features.
Mix of the most commonly used mixin classes.
Definition: valueobject.h:114
Entity with timestamp.
ColumnIndex
Base class enums.
Definition: mixinindex.h:44
Value object for a raw FSD message.
Definition: rawfsdmessage.h:25
void setRawMessage(const QString &rawMessage)
Set raw message.
Definition: rawfsdmessage.h:43
const QString & getRawMessage() const
Get raw message.
Definition: rawfsdmessage.h:40
CRawFsdMessage()=default
Default constructor.
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition: metaclass.h:73
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition: metaclass.h:53
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition: valueobject.h:65