libdrmconf  0.11.3
A library to program DMR radios.
configreference.hh
1 #ifndef CONFIGREFERENCE_HH
2 #define CONFIGREFERENCE_HH
3 
4 #include "configobject.hh"
5 #include <QSet>
6 
7 class Channel;
8 class DMRChannel;
9 class FMChannel;
10 class ScanList;
11 class EncryptionKey;
12 
16 class ConfigObjectReference: public QObject
17 {
18  Q_OBJECT
19 
20 protected:
22  ConfigObjectReference(const QMetaObject &elementType=ConfigObject::staticMetaObject, QObject *parent = nullptr);
23 
24 public:
27  bool isNull() const;
28 
31  virtual void clear();
34  virtual bool set(ConfigObject *object);
36  virtual bool copy(const ConfigObjectReference *ref);
38  virtual bool allow(const QMetaObject *elementType);
39 
41  const QStringList &elementTypeNames() const;
42 
44  template <class Type>
45  Type *as() const {
46  if (nullptr == _object)
47  return nullptr;
48  return _object->as<Type>();
49  }
50 
52  template <class Type>
53  bool is() const {
54  if (nullptr == _object)
55  return false;
56  return _object->is<Type>();
57  }
58 
60  int compare(const ConfigObjectReference &other) const;
61 
62 signals:
65  void modified();
66 
67 protected slots:
69  void onReferenceDeleted(QObject *obj);
70 
71 protected:
73  QStringList _elementTypes;
76 };
77 
78 
83 {
84  Q_OBJECT
85 
86 protected:
88  ContactReference(const QMetaObject &elementType, QObject *parent = nullptr);
89 
90 public:
92  explicit ContactReference(QObject *parent=nullptr);
93 };
94 
95 
99 {
100  Q_OBJECT
101 
102 public:
104  explicit DMRContactReference(QObject *parent=nullptr);
105 };
106 
107 
110 {
111  Q_OBJECT
112 
113 public:
115  explicit DMRContactRefList(QObject *parent=nullptr);
116 };
117 
118 
123 {
124  Q_OBJECT
125 
126 protected:
128  ChannelReference(const QMetaObject &elementType, QObject *parent = nullptr);
129 
130 public:
132  explicit ChannelReference(QObject *parent=nullptr);
133 };
134 
135 
139 {
140  Q_OBJECT
141 
142 public:
144  explicit DMRChannelReference(QObject *parent=nullptr);
145 };
146 
147 
151 {
152  Q_OBJECT
153 
154 public:
156  explicit FMChannelReference(QObject *parent=nullptr);
157 };
158 
159 
163 {
164  Q_OBJECT
165 
166 protected:
168  explicit ChannelRefList(const QMetaObject &elementTypes, QObject *parent = nullptr);
169 
170 public:
172  explicit ChannelRefList(QObject *parent=nullptr);
173 };
174 
175 
179 {
180  Q_OBJECT
181 
182 public:
184  explicit DMRChannelRefList(QObject *parent=nullptr);
185 };
186 
187 
191 {
192  Q_OBJECT
193 
194 public:
196  explicit RoamingChannelRefList(QObject *parent=nullptr);
197 };
198 
199 
203 {
204  Q_OBJECT
205 
206 public:
208  explicit ScanListReference(QObject *parent=nullptr);
209 };
210 
211 
215  Q_OBJECT
216 
217 protected:
219  PositioningSystemReference(const QMetaObject &elementType, QObject *parent = nullptr);
220 
221 public:
223  explicit PositioningSystemReference(QObject *parent=nullptr);
224 };
225 
226 
230  Q_OBJECT
231 
232 public:
234  explicit APRSSystemReference(QObject *parent=nullptr);
235 };
236 
237 
241  Q_OBJECT
242 
243 public:
245  explicit GPSSystemReference(QObject *parent=nullptr);
246 };
247 
248 
252  Q_OBJECT
253 
254 public:
256  explicit DMRRadioIDReference(QObject *parent=nullptr);
257 };
258 
259 
263  Q_OBJECT
264 
265 public:
267  explicit GroupListReference(QObject *parent=nullptr);
268 };
269 
270 
274  Q_OBJECT
275 
276 public:
278  explicit RoamingZoneReference(QObject *parent=nullptr);
279 };
280 
281 
285  Q_OBJECT
286 
287 public:
289  explicit EncryptionKeyReference(QObject *parent=nullptr);
290 };
291 
292 
296  Q_OBJECT
297 
298 public:
300  explicit ZoneReference(QObject *parent=nullptr);
301 };
302 
303 
304 #endif // CONFIGREFERENCE_HH
Implements a reference to an APRS system.
Definition: configreference.hh:229
APRSSystemReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:248
const QList< QMetaObject > & elementTypes() const
Returns the element type for this list.
Definition: configobject.cc:1242
Represents a list of weak references to channels (analog and digital).
Definition: configreference.hh:163
ChannelRefList(const QMetaObject &elementTypes, QObject *parent=nullptr)
Hidden constructor.
Definition: configreference.cc:186
Represents a reference to a channel.
Definition: configreference.hh:123
ChannelReference(const QMetaObject &elementType, QObject *parent=nullptr)
Hidden constructor.
Definition: configreference.cc:150
The base class of all channels (analog and digital) of a codeplug configuration.
Definition: channel.hh:34
bool is() const
Returns true if this object is of class Object.
Definition: configobject.hh:147
const Object * as() const
Casts this object to the given type.
Definition: configobject.hh:153
List class for config objects.
Definition: configobject.hh:382
Implements a reference to a config object.
Definition: configreference.hh:17
const QStringList & elementTypeNames() const
Returns the type names of allowed objects.
Definition: configreference.cc:96
void onReferenceDeleted(QObject *obj)
Internal call back whenever the referenced object gets deleted.
Definition: configreference.cc:101
int compare(const ConfigObjectReference &other) const
Compares the references.
Definition: configreference.cc:78
virtual bool copy(const ConfigObjectReference *ref)
Copies the reference from another reference.
Definition: configreference.cc:70
QStringList _elementTypes
Holds the static QMetaObject of the possible element types.
Definition: configreference.hh:73
ConfigObject * _object
The reference to the object.
Definition: configreference.hh:75
virtual bool set(ConfigObject *object)
Sets the reference.
Definition: configreference.cc:38
virtual void clear()
Resets the reference.
Definition: configreference.cc:29
ConfigObjectReference(const QMetaObject &elementType=ConfigObject::staticMetaObject, QObject *parent=nullptr)
Hidden constructor.
Definition: configreference.cc:17
void modified()
Gets emitted if the reference is changed.
Type * as() const
Returns the reference as the specified type.
Definition: configreference.hh:45
virtual bool allow(const QMetaObject *elementType)
Adds a possible type to this reference.
Definition: configreference.cc:89
bool is() const
Returns true if the reference is of the specified type.
Definition: configreference.hh:53
bool isNull() const
Returns true if the reference is null.
Definition: configreference.cc:24
Base class of all labeled and named objects.
Definition: configobject.hh:199
Represents a reference to a contact.
Definition: configreference.hh:83
ContactReference(const QMetaObject &elementType, QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:114
Represents a list of references to some DMR channels.
Definition: configreference.hh:179
DMRChannelRefList(QObject *parent=nullptr)
Empty constructor.
Definition: configreference.cc:202
Implements a reference to a DMR channel.
Definition: configreference.hh:139
DMRChannelReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:166
Extension to the DigitalChannel class to implement an DMR channel.
Definition: channel.hh:350
List of references to DMR contacts.
Definition: configreference.hh:110
DMRContactRefList(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:140
Represents a reference to a DMR contact.
Definition: configreference.hh:99
DMRContactReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:130
Implements a reference to a radio ID.
Definition: configreference.hh:251
DMRRadioIDReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:268
Implements a reference to an encryption key.
Definition: configreference.hh:284
EncryptionKeyReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:298
Base class of all encryption keys.
Definition: encryptionextension.hh:10
Implements a reference to a FM channel.
Definition: configreference.hh:151
FMChannelReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:176
Extension to the AnalogChannel class to implement an analog FM channel.
Definition: channel.hh:210
Implements a reference to a GPS system.
Definition: configreference.hh:240
GPSSystemReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:258
Implements a reference to a group list.
Definition: configreference.hh:262
GroupListReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:278
Implements a reference to a positioning system.
Definition: configreference.hh:214
PositioningSystemReference(const QMetaObject &elementType, QObject *parent=nullptr)
Hidden constructor.
Definition: configreference.cc:232
Represents a list of references to some roaming channels.
Definition: configreference.hh:191
RoamingChannelRefList(QObject *parent=nullptr)
Empty constructor.
Definition: configreference.cc:212
Implements a reference to a roaming zone.
Definition: configreference.hh:273
RoamingZoneReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:288
Implements a reference to a scan list.
Definition: configreference.hh:203
ScanListReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:222
Generic representation of a scan list.
Definition: scanlist.hh:15
Implements a reference to a zone.
Definition: configreference.hh:295
ZoneReference(QObject *parent=nullptr)
Constructor.
Definition: configreference.cc:308