libdrmconf
0.12.0
A library to program DMR radios.
|
Implements a visitor to merge the visited config into a given config. More...
#include <configmergevisitor.hh>
Public Types | |
enum class | ItemStrategy { Ignore , Override , Duplicate } |
Possible strategies to merge atomic items. More... | |
enum class | SetStrategy { Ignore , Override , Duplicate , Merge } |
Possible strategies to merge sets of references. More... | |
Public Member Functions | |
ConfigMergeVisitor (Config *destination, QHash< ConfigObject *, ConfigObject * > &translation, ItemStrategy itemStrategy=ItemStrategy::Ignore, SetStrategy setStrategy=SetStrategy::Ignore) | |
Constructor of the merge visitor. More... | |
bool | processItem (ConfigItem *item, const ErrorStack &err=ErrorStack()) |
Traverses the specified config item. More... | |
Public Member Functions inherited from Visitor | |
virtual | ~Visitor () |
Destructor. | |
virtual bool | process (Config *config, const ErrorStack &err=ErrorStack()) |
Traverses the properties of the configuration recursively. More... | |
virtual bool | processProperty (ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack()) |
Processes the specified property of the item. More... | |
virtual bool | processEnum (ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack()) |
Handles an enum typed property. More... | |
virtual bool | processBool (ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack()) |
Handles a boolean typed property. More... | |
virtual bool | processInt (ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack()) |
Handles an integer typed property. More... | |
virtual bool | processUInt (ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack()) |
Handles an unsigned integer typed property. More... | |
virtual bool | processDouble (ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack()) |
Handles a double precision float typed property. More... | |
virtual bool | processString (ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack()) |
Handles a string typed property. More... | |
virtual bool | processFrequency (ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack()) |
Handles a Frequency typed property. More... | |
virtual bool | processInterval (ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack()) |
Handles a Interval typed property. More... | |
virtual bool | processUnknownType (ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack()) |
Handles a property of unknown type. More... | |
virtual bool | processList (AbstractConfigObjectList *list, const ErrorStack &err=ErrorStack()) |
Traverses the list of objects or references. More... | |
virtual bool | processReference (ConfigObjectReference *, const ErrorStack &err=ErrorStack()) |
Handles references to config objects. More... | |
Protected Member Functions | |
bool | processRadioID (RadioID *item, const ErrorStack &err=ErrorStack()) |
Handles a RadioID object of the source configuration. | |
bool | processChannel (Channel *item, const ErrorStack &err=ErrorStack()) |
Handles a Channel object of the source configuration. | |
bool | processContact (Contact *item, const ErrorStack &err=ErrorStack()) |
Handles a Contact object of the source configuration. | |
bool | processPositioningSystem (PositioningSystem *item, const ErrorStack &err=ErrorStack()) |
Handles a PositioningSystem object of the source configuration. | |
bool | processRoamingChannel (RoamingChannel *item, const ErrorStack &err=ErrorStack()) |
Handles a RoamingChannel object of the source configuration. | |
bool | processGroupList (RXGroupList *item, const ErrorStack &err=ErrorStack()) |
Handles a RXGroupList object of the source configuration. | |
bool | processZone (Zone *item, const ErrorStack &err=ErrorStack()) |
Handles a Zone object of the source configuration. | |
bool | processScanList (ScanList *item, const ErrorStack &err=ErrorStack()) |
Handles a ScanList object of the source configuration. | |
bool | processRoamingZone (RoamingZone *item, const ErrorStack &err=ErrorStack()) |
Handles a RoamingZone object of the source configuration. | |
bool | addObject (AbstractConfigObjectList *list, ConfigObject *present, ConfigObject *merging, const ErrorStack &err=ErrorStack()) |
Adds a copy of the merging object to the given list, containing the colliding present object. More... | |
bool | ignoreObject (AbstractConfigObjectList *list, ConfigObject *present, ConfigObject *merging, const ErrorStack &err=ErrorStack()) |
Does not add the merging object, but fixes the translation table to bend references to the merging object. | |
bool | replaceObject (AbstractConfigObjectList *list, ConfigObject *present, ConfigObject *merging, const ErrorStack &err=ErrorStack()) |
Replaces the present object in the given list by a copy of merging object. More... | |
bool | duplicateObject (AbstractConfigObjectList *list, ConfigObject *present, ConfigObject *merging, const ErrorStack &err=ErrorStack()) |
Adds a copy of the merging object to the given list. | |
bool | mergeList (ConfigObjectRefList *present, ConfigObjectRefList *merging, const ErrorStack &err=ErrorStack()) |
Merges two reference lists. More... | |
Protected Member Functions inherited from Visitor | |
Visitor () | |
Hidden constructor. | |
Protected Attributes | |
Config * | _destination |
The destination configuration. | |
QHash< ConfigObject *, ConfigObject * > & | _translation |
Translation table for fixing references. | |
ItemStrategy | _itemStrategy |
The item merge strategy. | |
SetStrategy | _setStrategy |
The set merge strategy. | |
Implements a visitor to merge the visited config into a given config.
The destination configuration object is passed to the constructor. This allows to merge several configurations into one.
|
strong |
Possible strategies to merge atomic items.
That is, Channels, Contacts & PositioningSystems, if there are two items with the same name.
Enumerator | |
---|---|
Ignore | Ignore the source item. |
Override | Override the destination item. |
Duplicate | Add a new item with a modified name. |
|
strong |
Possible strategies to merge sets of references.
That is, GroupLists, Zones & ScanLists, if tehre are two sets with the same name.
Enumerator | |
---|---|
Ignore | Ignore the source set. |
Override | Override the destination item. |
Duplicate | Add a new set with a modified name. |
Merge | Merge sets. |
ConfigMergeVisitor::ConfigMergeVisitor | ( | Config * | destination, |
QHash< ConfigObject *, ConfigObject * > & | translation, | ||
ItemStrategy | itemStrategy = ItemStrategy::Ignore , |
||
SetStrategy | setStrategy = SetStrategy::Ignore |
||
) |
Constructor of the merge visitor.
destination | Specifies the destination configuration, the additional configurations are merged into. |
itemStrategy | Specifies the item merge strategy. |
setStrategy | Specifies the set merge strategy. |
|
protected |
Adds a copy of the merging
object to the given list, containing the colliding present
object.
Also updates the translation table to bend references to the merging object to that copy.
|
protected |
Merges two reference lists.
That is, merging
gets merged into the present
list.
|
virtual |
Traverses the specified config item.
This method calls processProperty
on all properties of the item.
Reimplemented from Visitor.
|
protected |
Replaces the present
object in the given list by a copy of merging
object.
Also fixes the translation table to bend references to both the removed present
object as well as the merging
object.