libdrmconf 0.12.1
A library to program DMR radios.
Loading...
Searching...
No Matches
configreference.hh
1#ifndef CONFIGREFERENCE_HH
2#define CONFIGREFERENCE_HH
3
4#include "configobject.hh"
5#include <QSet>
6
7class Channel;
8class DMRChannel;
9class FMChannel;
10class ScanList;
11class EncryptionKey;
12
16class ConfigObjectReference: public QObject
17{
18 Q_OBJECT
19
20protected:
22 ConfigObjectReference(const QMetaObject &elementType=ConfigObject::staticMetaObject, QObject *parent = nullptr);
23
24public:
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
62signals:
65 void modified();
66
67protected slots:
69 void onReferenceDeleted(QObject *obj);
70
71protected:
73 QStringList _elementTypes;
76};
77
78
83{
84 Q_OBJECT
85
86protected:
88 ContactReference(const QMetaObject &elementType, QObject *parent = nullptr);
89
90public:
92 explicit ContactReference(QObject *parent=nullptr);
93};
94
95
99{
100 Q_OBJECT
101
102public:
104 explicit DMRContactReference(QObject *parent=nullptr);
105};
106
107
110{
111 Q_OBJECT
112
113public:
115 explicit DMRContactRefList(QObject *parent=nullptr);
116};
117
118
123{
124 Q_OBJECT
125
126protected:
128 ChannelReference(const QMetaObject &elementType, QObject *parent = nullptr);
129
130public:
132 explicit ChannelReference(QObject *parent=nullptr);
133};
134
135
139{
140 Q_OBJECT
141
142public:
144 explicit DMRChannelReference(QObject *parent=nullptr);
145};
146
147
151{
152 Q_OBJECT
153
154public:
156 explicit FMChannelReference(QObject *parent=nullptr);
157};
158
159
163{
164 Q_OBJECT
165
166protected:
168 explicit ChannelRefList(const QMetaObject &elementTypes, QObject *parent = nullptr);
169
170public:
172 explicit ChannelRefList(QObject *parent=nullptr);
173};
174
175
179{
180 Q_OBJECT
181
182public:
184 explicit DMRChannelRefList(QObject *parent=nullptr);
185};
186
187
191{
192 Q_OBJECT
193
194public:
196 explicit RoamingChannelRefList(QObject *parent=nullptr);
197};
198
199
203{
204 Q_OBJECT
205
206public:
208 explicit ScanListReference(QObject *parent=nullptr);
209};
210
211
215 Q_OBJECT
216
217protected:
219 PositioningSystemReference(const QMetaObject &elementType, QObject *parent = nullptr);
220
221public:
223 explicit PositioningSystemReference(QObject *parent=nullptr);
224};
225
226
230 Q_OBJECT
231
232public:
234 explicit APRSSystemReference(QObject *parent=nullptr);
235};
236
237
241 Q_OBJECT
242
243public:
245 explicit GPSSystemReference(QObject *parent=nullptr);
246};
247
248
252 Q_OBJECT
253
254public:
256 explicit DMRRadioIDReference(QObject *parent=nullptr);
257};
258
259
263 Q_OBJECT
264
265public:
267 explicit GroupListReference(QObject *parent=nullptr);
268};
269
270
274 Q_OBJECT
275
276public:
278 explicit RoamingZoneReference(QObject *parent=nullptr);
279};
280
281
285 Q_OBJECT
286
287public:
289 explicit EncryptionKeyReference(QObject *parent=nullptr);
290};
291
292
296 Q_OBJECT
297
298public:
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:249
const QList< QMetaObject > & elementTypes() const
Returns the element type for this list.
Definition configobject.cc:1353
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:187
Represents a reference to a channel.
Definition configreference.hh:123
ChannelReference(const QMetaObject &elementType, QObject *parent=nullptr)
Hidden constructor.
Definition configreference.cc:151
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:390
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:97
void onReferenceDeleted(QObject *obj)
Internal call back whenever the referenced object gets deleted.
Definition configreference.cc:102
int compare(const ConfigObjectReference &other) const
Compares the references.
Definition configreference.cc:79
virtual bool copy(const ConfigObjectReference *ref)
Copies the reference from another reference.
Definition configreference.cc:71
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.
virtual bool allow(const QMetaObject *elementType)
Adds a possible type to this reference.
Definition configreference.cc:90
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
Type * as() const
Returns the reference as the specified type.
Definition configreference.hh:45
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:115
Represents a list of references to some DMR channels.
Definition configreference.hh:179
DMRChannelRefList(QObject *parent=nullptr)
Empty constructor.
Definition configreference.cc:203
Implements a reference to a DMR channel.
Definition configreference.hh:139
DMRChannelReference(QObject *parent=nullptr)
Constructor.
Definition configreference.cc:167
Extension to the DigitalChannel class to implement an DMR channel.
Definition channel.hh:354
List of references to DMR contacts.
Definition configreference.hh:110
DMRContactRefList(QObject *parent=nullptr)
Constructor.
Definition configreference.cc:141
Represents a reference to a DMR contact.
Definition configreference.hh:99
DMRContactReference(QObject *parent=nullptr)
Constructor.
Definition configreference.cc:131
Implements a reference to a radio ID.
Definition configreference.hh:251
DMRRadioIDReference(QObject *parent=nullptr)
Constructor.
Definition configreference.cc:269
Implements a reference to an encryption key.
Definition configreference.hh:284
EncryptionKeyReference(QObject *parent=nullptr)
Constructor.
Definition configreference.cc:299
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:177
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:259
Implements a reference to a group list.
Definition configreference.hh:262
GroupListReference(QObject *parent=nullptr)
Constructor.
Definition configreference.cc:279
Implements a reference to a positioning system.
Definition configreference.hh:214
PositioningSystemReference(const QMetaObject &elementType, QObject *parent=nullptr)
Hidden constructor.
Definition configreference.cc:233
Represents a list of references to some roaming channels.
Definition configreference.hh:191
RoamingChannelRefList(QObject *parent=nullptr)
Empty constructor.
Definition configreference.cc:213
Implements a reference to a roaming zone.
Definition configreference.hh:273
RoamingZoneReference(QObject *parent=nullptr)
Constructor.
Definition configreference.cc:289
Implements a reference to a scan list.
Definition configreference.hh:203
ScanListReference(QObject *parent=nullptr)
Constructor.
Definition configreference.cc:223
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:309