libdrmconf
0.12.0
A library to program DMR radios.
|
Base class for all codeplug contexts. More...
#include <codeplug.hh>
Classes | |
class | Table |
Internal used table type to associate objects and indices. More... | |
Public Member Functions | |
Context (Config *config) | |
Empty constructor. | |
Config * | config () const |
Returns the reference to the config object. | |
ConfigItem * | obj (const QMetaObject *elementType, unsigned idx) |
Resolves the given index for the specifies element type. More... | |
int | index (ConfigItem *obj) |
Returns the index for the given object. More... | |
bool | add (ConfigItem *obj, unsigned idx) |
Associates the given object with the given index. | |
bool | addTable (const QMetaObject *obj) |
Adds a table for the given type. | |
bool | hasTable (const QMetaObject *obj) const |
Returns true if a table is defined for the given type. | |
template<class T > | |
T * | get (unsigned idx) |
Returns the object associated by the given index and type. | |
template<class T > | |
bool | has (unsigned idx) |
Returns true , if the given index is defined for the specified type. | |
template<class T > | |
unsigned int | count () |
Returns the number of elements for the specified type. | |
Protected Member Functions | |
Table & | getTable (const QMetaObject *obj) |
Returns a reference to the table for the given type. | |
Protected Attributes | |
Config * | _config |
A weak reference to the config object. | |
QHash< QString, Table > | _tables |
Table of tables. | |
Base class for all codeplug contexts.
Each device specific codeplug may extend this class to allow for device specific elements to be indexed in a separate index. By default tables for DigitalContact
, RXGroupList
, Channel
, Zone
and ScanList
are defined. For any other type, an additional table must be defined first using addTable
.
int Codeplug::Context::index | ( | ConfigItem * | obj | ) |
Returns the index for the given object.
ConfigItem * Codeplug::Context::obj | ( | const QMetaObject * | elementType, |
unsigned | idx | ||
) |
Resolves the given index for the specifies element type.
nullptr
if the index is not defined or the type is unknown.