swift
simbriefdata.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2019 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_AVIATION_SIMBRIEFDATA_H
7 #define SWIFT_MISC_AVIATION_SIMBRIEFDATA_H
8 
9 #include <QString>
10 #include <QtGlobal>
11 
12 #include "misc/datacache.h"
13 #include "misc/metaclass.h"
14 #include "misc/network/url.h"
15 #include "misc/swiftmiscexport.h"
16 #include "misc/valueobject.h"
17 
18 SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::aviation, CSimBriefData)
19 
20 namespace swift::misc::aviation
21 {
23  class SWIFT_MISC_EXPORT CSimBriefData : public CValueObject<CSimBriefData>
24  {
25  public:
27  static const QStringList &getLogCategories();
28 
30  CSimBriefData();
31 
33  CSimBriefData(const QString &url, const QString &username);
34 
37  {
38  IndexUsername = CPropertyIndexRef::GlobalIndexCSimBriefData,
39  IndexUrl
40  };
41 
43  const QString &getUsername() const { return m_username; }
44 
46  void setUsername(const QString &un) { m_username = un; }
47 
49  const QString &getUrl() const { return m_url; }
50 
52  network::CUrl getUrlAndUsername() const;
53 
55  void setUrl(const QString &url) { m_url = url; }
56 
58  QVariant propertyByIndex(CPropertyIndexRef index) const;
59 
61  void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
62 
64  QString convertToQString(bool i18n = false) const;
65 
66  private:
67  QString m_url;
68  QString m_username;
69 
72  SWIFT_METAMEMBER(url),
73  SWIFT_METAMEMBER(username));
74  };
75 
76  namespace Data
77  {
79  struct TSimBriefData : public swift::misc::TDataTrait<CSimBriefData>
80  {
82  static const char *key() { return "simbriefdata"; }
83 
85  static constexpr bool isPinned() { return true; }
86  };
87  } // namespace Data
88 } // namespace swift::misc::aviation
89 
90 Q_DECLARE_METATYPE(swift::misc::aviation::CSimBriefData)
91 
92 #endif // SWIFT_MISC_AVIATION_SIMBRIEFDATA_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
Value object for a flight plan.
Definition: simbriefdata.h:24
void setUsername(const QString &un)
Set username.
Definition: simbriefdata.h:46
const QString & getUrl() const
Get URL.
Definition: simbriefdata.h:49
const QString & getUsername() const
Get username.
Definition: simbriefdata.h:43
void setUrl(const QString &url)
Set URL.
Definition: simbriefdata.h:55
Value object encapsulating information of a location, kind of simplified CValueObject compliant versi...
Definition: url.h:27
#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
Base class for traits to be used as template argument to swift::misc::CData.
Definition: datacache.h:459
Trait for global setup data.
Definition: simbriefdata.h:80
static constexpr bool isPinned()
First load is synchronous.
Definition: simbriefdata.h:85
static const char * key()
Key in data cache.
Definition: simbriefdata.h:82
#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