libdrmconf  0.12.0
A library to program DMR radios.
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Codeplug::Context Class Reference

Base class for all codeplug contexts. More...

#include <codeplug.hh>

Collaboration diagram for Codeplug::Context:
Collaboration graph
[legend]

Classes

class  Table
 Internal used table type to associate objects and indices. More...
 

Public Member Functions

 Context (Config *config)
 Empty constructor.
 
Configconfig () const
 Returns the reference to the config object.
 
ConfigItemobj (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

TablegetTable (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.
 

Detailed Description

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.

Since
0.9.0

Member Function Documentation

◆ index()

int Codeplug::Context::index ( ConfigItem obj)

Returns the index for the given object.

Returns
-1 if no index is associated with the object or its type is unknown.

◆ obj()

ConfigItem * Codeplug::Context::obj ( const QMetaObject *  elementType,
unsigned  idx 
)

Resolves the given index for the specifies element type.

Returns
nullptr if the index is not defined or the type is unknown.

The documentation for this class was generated from the following files: