33#include <QRegularExpression>
38#include "frequency.hh"
78 const QStringList &
stack()
const;
112 void push(
const QString &element);
145 typedef std::initializer_list< std::pair<QString, RadioLimitElement *> >
PropList;
173 QObject *parent=
nullptr);
207 QObject *parent=
nullptr);
234 QObject *parent=
nullptr);
256 QObject *parent=
nullptr);
300 QObject *parent=
nullptr);
322 RadioLimitUInt(qint64 minValue=-1, qint64 maxValue=-1, qint64 defValue=-1,
324 QObject *parent=
nullptr);
349 QObject *parent=
nullptr);
363 QObject *parent=
nullptr);
381 typedef std::initializer_list<std::pair<Frequency, Frequency>>
RangeList;
386 QObject *parent=
nullptr);
390 QObject *parent=
nullptr);
410 QObject *parent=
nullptr);
414 QObject *parent=
nullptr);
429 QObject *parent=
nullptr);
433 QObject *parent=
nullptr);
453 QObject *parent=
nullptr);
554 typedef std::initializer_list<std::pair<const QMetaObject&, RadioLimitObject *> >
TypeList;
581 QHash<QString, RadioLimitObject *>
_types;
600 RadioLimitObjRef(
const QMetaObject &type,
bool allowNull=
true, QObject *parent=
nullptr);
612 bool validType(
const QMetaObject *type)
const;
635 QObject *parent=
nullptr);
672 RadioLimitList(
const std::initializer_list<ElementLimits> &elements, QObject *parent=
nullptr);
702 RadioLimitRefList(
int minSize,
int maxSize,
const QMetaObject &type, QObject *parent=
nullptr);
708 bool validType(
const QMetaObject *type)
const;
776 explicit RadioLimits(
bool betaWarning, QObject *parent =
nullptr);
778 RadioLimits(
const std::initializer_list<std::pair<QString,RadioLimitElement *> > &list, QObject *parent=
nullptr);
Base class for all configuration objects (channels, zones, contacts, etc).
Definition configobject.hh:35
Base class of all labeled and named objects.
Definition configobject.hh:192
The config class, representing the codeplug configuration.
Definition config.hh:70
RadioLimitBool(QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:314
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:321
Collects the issues found during verification.
Definition radiolimits.hh:97
RadioLimitIssue::Severity _maxSeverity
Holds the highest severity of all messages.
Definition radiolimits.hh:132
bool ignoreFrequencyLimits() const
If true, frequency limit voilations are warnings.
Definition radiolimits.cc:121
void pop()
Pops the top-most property name/element index from the stack.
Definition radiolimits.cc:116
const RadioLimitIssue & message(int n) const
Returns the n-th issue.
Definition radiolimits.cc:106
RadioLimitContext(bool ignoreFrequencyLimits=false)
Empty constructor.
Definition radiolimits.cc:86
bool _ignoreFrequencyLimits
If true, any frequency range voilation is a warning.
Definition radiolimits.hh:130
void push(const QString &element)
Push a property name/element index onto the stack.
Definition radiolimits.cc:111
QStringList _stack
The current item stack.
Definition radiolimits.hh:126
QList< RadioLimitIssue > _messages
The list of issues found.
Definition radiolimits.hh:128
RadioLimitIssue::Severity maxSeverity() const
Returns the highest severity of the messages.
Definition radiolimits.cc:130
RadioLimitIssue & newMessage(RadioLimitIssue::Severity severity=RadioLimitIssue::Hint)
Constructs a new message and puts it into the list of issues.
Definition radiolimits.cc:93
int count() const
Returns the number of issues.
Definition radiolimits.cc:101
void enableIgnoreFrequencyLimits(bool enable=true)
Enables/disables that frequency range voilations are handled as warnings.
Definition radiolimits.cc:125
RadioLimitDMRId(RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Hint, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:403
virtual ~RadioLimitElement()
Destructor.
Definition radiolimits.cc:144
std::initializer_list< std::pair< QString, RadioLimitElement * > > PropList
Initializer lists of ConfigItem properties.
Definition radiolimits.hh:145
RadioLimitElement(QObject *parent=nullptr)
Hidden constructor.
Definition radiolimits.cc:138
virtual bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const =0
Verifies the given property of the specified item.
QSet< unsigned > _values
Holds the set of valid values.
Definition radiolimits.hh:369
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:420
RadioLimitEnum(const std::initializer_list< unsigned > &values, RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Hint, QObject *parent=nullptr)
Constructor from initializer list of possible enum values.
Definition radiolimits.cc:413
RadioLimitFrequencies(RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Warning, QObject *parent=nullptr)
Empty constructor.
Definition radiolimits.cc:450
std::initializer_list< std::pair< Frequency, Frequency > > RangeList
Typedef for the initializer list.
Definition radiolimits.hh:381
QList< FrequencyRange > _frequencyRanges
Holds the frequency ranges for the device.
Definition radiolimits.hh:396
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:465
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:961
qint64 _minSize
Holds the minimum size of the list.
Definition radiolimits.hh:738
RadioLimitGroupCallRefList(int minSize, int maxSize, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:954
qint64 _maxSize
Holds the maximum size of the list.
Definition radiolimits.hh:740
RadioLimitIssue::Severity _severity
The severity of the issue generated.
Definition radiolimits.hh:306
RadioLimitIgnoredBool(RadioLimitIssue::Severity notify=RadioLimitIssue::Hint, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:337
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:344
RadioLimitIssue::Severity _notification
Holds the level of the notification.
Definition radiolimits.hh:537
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:159
RadioLimitIgnored(RadioLimitIssue::Severity notify=RadioLimitIssue::Hint, QObject *parent=nullptr)
Constructor for a ignored setting verification element.
Definition radiolimits.cc:152
bool verifyObject(const ConfigObject *item, RadioLimitContext &context) const
Verifies the properties of the given object.
Definition radiolimits.cc:168
RadioLimitInterval(RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Warning, QObject *parent=nullptr)
Empty constructor.
Definition radiolimits.cc:525
Range< Interval > _durations
Holds the duration ranges for the interval.
Definition radiolimits.hh:439
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:539
Represents a single issue found during verification.
Definition radiolimits.hh:51
Severity
Defines the possible severity levels.
Definition radiolimits.hh:54
@ Critical
Assembly of the codeplug will fail or a non-functional codeplug might be created.
Definition radiolimits.hh:58
@ Hint
Just a hint, a working codeplug will be assembled.
Definition radiolimits.hh:56
@ Silent
The user will not be notified.
Definition radiolimits.hh:55
@ Warning
The codeplug gets changed but a working codeplug might be assembled.
Definition radiolimits.hh:57
Severity severity() const
Returns the severity of the issue.
Definition radiolimits.cc:54
QStringList _stack
Holds the item-stack (where the issue occurred).
Definition radiolimits.hh:86
RadioLimitIssue(Severity severity, const QStringList &stack)
Constructs an empty message for the specified severity at the specified point of the verification.
Definition radiolimits.cc:26
QString format() const
Formats the message.
Definition radiolimits.cc:69
const QString & message() const
Returns the text message.
Definition radiolimits.cc:59
const QStringList & stack() const
Returns the traceback of the issue.
Definition radiolimits.cc:64
RadioLimitIssue & operator=(const RadioLimitIssue &other)
Copy assignment.
Definition radiolimits.cc:39
QString _message
Holds the text message.
Definition radiolimits.hh:88
Severity _severity
Holds the severity of the issue.
Definition radiolimits.hh:84
virtual bool verifyItem(const ConfigItem *item, RadioLimitContext &context) const
Verifies the properties of the given item.
Definition radiolimits.cc:644
bool add(const QString &prop, RadioLimitElement *structure)
Adds a property declaration.
Definition radiolimits.cc:612
QHash< QString, RadioLimitElement * > _elements
Holds the property <-> limits map.
Definition radiolimits.hh:496
RadioLimitItem(QObject *parent=nullptr)
Empty constructor.
Definition radiolimits.cc:597
virtual bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:621
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:568
RadioLimitLevel(const Range< unsigned int > &range={0, 10}, bool allowInvalid=true, RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Warning, QObject *parent=nullptr)
Empty constructor.
Definition radiolimits.cc:560
QString findClassName(const QMetaObject &type) const
Searches for the specified type or one of its super-clsases in the set of allowed types.
Definition radiolimits.cc:882
RadioLimitList(const QMetaObject &type, int minSize, int maxSize, RadioLimitObject *element, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:796
QHash< QString, qint64 > _minCount
Maps typename to minimum count.
Definition radiolimits.hh:684
QHash< QString, RadioLimitObject * > _elements
Maps typename to element definition.
Definition radiolimits.hh:682
QHash< QString, qint64 > _maxCount
Maps typename to maximum count.
Definition radiolimits.hh:686
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:817
RadioLimitObjRefIgnored(ConfigObject *defObj=nullptr, RadioLimitIssue::Severity notify=RadioLimitIssue::Hint, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:771
ConfigObject * _default
A weak reference to a default value, that gets silently ignored.
Definition radiolimits.hh:643
RadioLimitIssue::Severity _severity
The severity of the issue.
Definition radiolimits.hh:641
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:780
std::initializer_list< QMetaObject > MetaObjectList
Initializer lists of allowed classes.
Definition radiolimits.hh:593
RadioLimitObjRef(const QMetaObject &type, bool allowNull=true, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:714
bool _allowNull
If true, a null reference is allowed.
Definition radiolimits.hh:616
bool validType(const QMetaObject *type) const
Checks if the given type is one of the valid ones in _types.
Definition radiolimits.cc:759
QSet< QString > _types
Possible classes of instances, the reference may point to.
Definition radiolimits.hh:618
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:728
Represents the limits for all properties of a ConfigObject instance.
Definition radiolimits.hh:503
virtual bool verifyObject(const ConfigObject *item, RadioLimitContext &context) const
Verifies the properties of the given object.
Definition radiolimits.cc:679
RadioLimitObject(QObject *parent=nullptr)
Empty constructor.
Definition radiolimits.cc:666
RadioLimitObjects(const TypeList &list, QObject *parent=nullptr)
Constructor from initializer list.
Definition radiolimits.cc:690
bool verifyItem(const ConfigItem *item, RadioLimitContext &context) const
Verifies the properties of the given item.
Definition radiolimits.cc:700
std::initializer_list< std::pair< const QMetaObject &, RadioLimitObject * > > TypeList
Initializer lists of type properties.
Definition radiolimits.hh:554
QHash< QString, RadioLimitObject * > _types
Maps class-names to object limits.
Definition radiolimits.hh:581
RadioLimitPin(int length=-1, RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Warning, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:271
qint64 _maxSize
Holds the maximum size of the list.
Definition radiolimits.hh:714
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:901
QSet< QString > _types
Possible classes of instances, the references may point to.
Definition radiolimits.hh:716
RadioLimitRefList(int minSize, int maxSize, const QMetaObject &type, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:894
qint64 _minSize
Holds the minimum size of the list.
Definition radiolimits.hh:712
bool validType(const QMetaObject *type) const
Checks if the given type is one of the valid ones in _types.
Definition radiolimits.cc:942
RadioLimitSingleZone(qint64 maxSize, const PropList &list, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:1010
bool verifyItem(const ConfigItem *item, RadioLimitContext &context) const
Verifies the properties of the given item.
Definition radiolimits.cc:1019
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:291
RadioLimitStringIgnored(RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Hint, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:284
QRegularExpression _pattern
Holds the regular expression pattern.
Definition radiolimits.hh:240
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:246
RadioLimitStringRegEx(const QString &pattern, RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Warning, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:239
int _minLen
Holds the minimum length of the string.
Definition radiolimits.hh:213
RadioLimitString(int minLen, int maxLen, Encoding enc, RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Hint, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:191
int _maxLen
Holds the maximum length of the string.
Definition radiolimits.hh:215
Encoding
Possible encoding of strings.
Definition radiolimits.hh:193
@ ASCII
Just ASCII is allowed.
Definition radiolimits.hh:195
@ Unicode
Any Unicode character is allowed.
Definition radiolimits.hh:196
@ DTMF
Just DTMF symbols are allowed (0-9, A-D, *, #).
Definition radiolimits.hh:194
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:198
Encoding _encoding
Holds the allowed character encoding.
Definition radiolimits.hh:217
RadioLimitTransmitFrequencies(RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Warning, QObject *parent=nullptr)
Empty constructor.
Definition radiolimits.cc:494
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:507
qint64 _maxValue
Holds the maximum value.
Definition radiolimits.hh:332
qint64 _defValue
Holds the default value.
Definition radiolimits.hh:334
bool verify(const ConfigItem *item, const QMetaProperty &prop, RadioLimitContext &context) const
Verifies the given property of the specified item.
Definition radiolimits.cc:374
RadioLimitUInt(qint64 minValue=-1, qint64 maxValue=-1, qint64 defValue=-1, RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Hint, QObject *parent=nullptr)
Constructor.
Definition radiolimits.cc:366
qint64 _minValue
Holds the minimum value.
Definition radiolimits.hh:330
RadioLimitIssue::Severity _severity
The severity of the issue, if the test fails.
Definition radiolimits.hh:177
RadioLimitValue(RadioLimitIssue::Severity severity=RadioLimitIssue::Severity::Hint, QObject *parent=nullptr)
Hidden constructor.
Definition radiolimits.cc:181
Represents the limits or the entire codeplug.
Definition radiolimits.hh:771
bool _satelliteConfigImplemented
If true, satellite config is implemented.
Definition radiolimits.hh:810
unsigned numCallSignDBEntries() const
Returns the maximum number of entries in the call-sign DB.
Definition radiolimits.cc:1065
virtual bool verifyConfig(const Config *config, RadioLimitContext &context) const
Verifies the given configuration.
Definition radiolimits.cc:1087
bool hasSatelliteConfig() const
Returns true if the radio supports satellite config.
Definition radiolimits.cc:1071
bool _callSignDBImplemented
If true, the call-sign is implemented.
Definition radiolimits.hh:804
bool _hasSatelliteConfig
If true, the radio supports satellite config.
Definition radiolimits.hh:808
bool _hasCallSignDB
If true, the radio supports a call-sign DB.
Definition radiolimits.hh:802
bool satelliteConfigImplemented() const
Returns true if satellite config is implemented.
Definition radiolimits.cc:1076
bool hasCallSignDB() const
Returns true if the radio supports a call-sign DB.
Definition radiolimits.cc:1055
unsigned _numSatellites
Holds the number of possible satellites.
Definition radiolimits.hh:812
unsigned _numCallSignDBEntries
Holds the number of possible call-sign DB entries.
Definition radiolimits.hh:806
RadioLimits(bool betaWarning, QObject *parent=nullptr)
Empty constructor.
Definition radiolimits.cc:1037
bool callSignDBImplemented() const
Returns true if the call-sign DB is implemented.
Definition radiolimits.cc:1060
bool _betaWarning
If true, a warning is issued that the radio is still under development and not well tested yet.
Definition radiolimits.hh:800
unsigned numSatellites() const
Returns the maximum number of satellites.
Definition radiolimits.cc:1081
Simple range class representing some range in some data type.
Definition ranges.hh:14
Helper struct to pass list entry definitions.
Definition radiolimits.hh:655
int minCount
Minimum count of elements.
Definition radiolimits.hh:657
const QMetaObject & type
The type of the object.
Definition radiolimits.hh:656
int maxCount
Maximum count of elements.
Definition radiolimits.hh:658
RadioLimitObject * structure
The structure of the elements.
Definition radiolimits.hh:659