libdrmconf 0.12.1
A library to program DMR radios.
|
Generic list class for config objects. More...
#include <configobject.hh>
Public Member Functions | |
virtual bool | copy (const AbstractConfigObjectList &other) |
Copies all elements from other to this list. | |
virtual bool | label (ConfigItem::Context &context, const ErrorStack &err=ErrorStack())=0 |
Recursively labels the config object. | |
virtual YAML::Node | serialize (const ConfigItem::Context &context, const ErrorStack &err=ErrorStack())=0 |
Recursively serializes the configuration to YAML nodes. | |
virtual int | count () const |
Returns the number of elements in the list. | |
virtual int | indexOf (ConfigObject *obj) const |
Returns the index of the given object within the list. | |
virtual void | clear () |
Clears the list. | |
virtual const Config * | config () const |
Returns the config object, this list belongs to. | |
virtual void | findItemsOfTypes (const QStringList &typeNames, QSet< ConfigItem * > &items) const |
Searches the config tree to find all instances of the given type names. | |
virtual QList< ConfigObject * > | findItemsByName (const QString name) const |
Searches the list for objects with the given name. | |
virtual bool | has (ConfigObject *obj) const |
Returns true , if the list contains the given object. | |
virtual ConfigObject * | get (int idx) const |
Returns the list element at the given index or nullptr if out of bounds. | |
virtual int | add (ConfigObject *obj, int row=-1, bool unique=true) |
Adds an element to the list. | |
virtual int | replace (ConfigObject *obj, int row, bool unique=true) |
Replaces an element in the list. | |
virtual bool | take (ConfigObject *obj) |
Removes an element from the list. | |
virtual bool | del (ConfigObject *obj) |
Removes an element from the list (and deletes it if owned). | |
virtual bool | moveUp (int idx) |
Moves an object at index idx one step up. | |
virtual bool | moveUp (int first, int last) |
Moves objects at [first, last] one step up. | |
virtual bool | moveDown (int idx) |
Moves an object at index idx one step down. | |
virtual bool | moveDown (int first, int last) |
Moves objects [first, last] one step down. | |
virtual bool | move (int source, int count, int destination) |
Moves the given source range to the destination index. | |
const QList< QMetaObject > & | elementTypes () const |
Returns the element type for this list. | |
QStringList | classNames () const |
Returns a list of all class names. | |
Protected Member Functions | |
AbstractConfigObjectList (const QMetaObject &elementTypes=ConfigObject::staticMetaObject, QObject *parent=nullptr) | |
Hidden constructor. | |
AbstractConfigObjectList (const std::initializer_list< QMetaObject > &elementTypes, QObject *parent=nullptr) | |
Hidden constructor from initializer list. | |
Protected Attributes | |
QList< QMetaObject > | _elementTypes |
Holds the static QMetaObject of the element type. | |
QVector< ConfigObject * > | _items |
Holds the list items. | |
Generic list class for config objects.
|
virtual |
Adds an element to the list.
Reimplemented in ChannelList, ConfigObjectList, ContactList, EncryptionKeys, PositioningSystems, RadioIDList, RoamingChannelList, RoamingZoneList, RXGroupLists, ScanLists, and ZoneList.
|
virtual |
Clears the list.
Reimplemented in ConfigObjectList, and RadioIDList.
|
virtual |
Copies all elements from other
to this list.
Reimplemented in ConfigObjectList.
|
virtual |
Removes an element from the list (and deletes it if owned).
Reimplemented in ConfigObjectList.
|
pure virtual |
Recursively labels the config object.
Implemented in ConfigObjectList, and ConfigObjectRefList.
|
virtual |
Moves the given source range to the destination index.
The destination index is given before the movement. That is, if elements 0 & 1 are moved to indices 1 & 2, call move(0,2, 2)
|
pure virtual |
Recursively serializes the configuration to YAML nodes.
The complete configuration must be labeled first.
Implemented in ConfigObjectList, and ConfigObjectRefList.
|
virtual |
Removes an element from the list.
Reimplemented in ConfigObjectList.