libdrmconf 0.12.1
A library to program DMR radios.
Loading...
Searching...
No Matches
configcopyvisitor.hh
1#ifndef CONFIGCOPYVISITOR_HH
2#define CONFIGCOPYVISITOR_HH
3
4#include "visitor.hh"
5
6class ConfigObject;
7class Channel;
8
13{
14public:
17 ConfigCloneVisitor(QHash<ConfigObject *, ConfigObject*> &map);
18
19 bool processProperty(ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack());
20 bool processItem(ConfigItem *item, const ErrorStack &err=ErrorStack());
22
24 virtual bool processChannel(Channel *item, const ErrorStack &err=ErrorStack());
25
28
29protected:
31 QList<QObject *> _stack;
33 QHash<ConfigObject *, ConfigObject*> &_map;
34};
35
36
42{
43public:
45 FixReferencesVisistor(QHash<ConfigObject *, ConfigObject*> &map, bool keepUnknown=false);
46
47 bool processProperty(ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack());
49
50protected:
52 QHash<ConfigObject *, ConfigObject*> &_map;
55};
56
59public:
61 static ConfigItem *copy(ConfigItem *original, const ErrorStack &err=ErrorStack());
62};
63
64#endif // CONFIGCOPYVISITOR_HH
Generic list class for config objects.
Definition configobject.hh:258
The base class of all channels (analog and digital) of a codeplug configuration.
Definition channel.hh:34
This visitor traverses the the given configuration and clones it.
Definition configcopyvisitor.hh:13
ConfigCloneVisitor(QHash< ConfigObject *, ConfigObject * > &map)
Constructor.
Definition configcopyvisitor.cc:12
bool processItem(ConfigItem *item, const ErrorStack &err=ErrorStack())
Traverses the specified config item.
Definition configcopyvisitor.cc:190
QHash< ConfigObject *, ConfigObject * > & _map
Reference to the translation table origial -> cloned object.
Definition configcopyvisitor.hh:33
ConfigItem * takeResult(const ErrorStack &err=ErrorStack())
Extracts the cloned item.
Definition configcopyvisitor.cc:268
QList< QObject * > _stack
Stack of the current object.
Definition configcopyvisitor.hh:31
bool processList(AbstractConfigObjectList *list, const ErrorStack &err=ErrorStack())
Traverses the list of objects or references.
Definition configcopyvisitor.cc:227
bool processProperty(ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack())
Processes the specified property of the item.
Definition configcopyvisitor.cc:20
virtual bool processChannel(Channel *item, const ErrorStack &err=ErrorStack())
Specialized handler for channels, must traverse the channel object.
Definition configcopyvisitor.cc:215
Just a name space to hold the copy function.
Definition configcopyvisitor.hh:58
static ConfigItem * copy(ConfigItem *original, const ErrorStack &err=ErrorStack())
Copies the given item.
Definition configcopyvisitor.cc:355
Base class for all configuration objects (channels, zones, contacts, etc).
Definition configobject.hh:40
Base class of all labeled and named objects.
Definition configobject.hh:199
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:41
Replaces references using a specified map.
Definition configcopyvisitor.hh:42
bool processProperty(ConfigItem *item, const QMetaProperty &prop, const ErrorStack &err=ErrorStack())
Processes the specified property of the item.
Definition configcopyvisitor.cc:299
QHash< ConfigObject *, ConfigObject * > & _map
Reference to the translation table origial -> cloned object.
Definition configcopyvisitor.hh:52
bool _keepUnknown
If false, an unmapped reference is an error.
Definition configcopyvisitor.hh:54
bool processList(AbstractConfigObjectList *list, const ErrorStack &err=ErrorStack())
Traverses the list of objects or references.
Definition configcopyvisitor.cc:323
FixReferencesVisistor(QHash< ConfigObject *, ConfigObject * > &map, bool keepUnknown=false)
Constructor.
Definition configcopyvisitor.cc:289
Base visitor class for the config tree.
Definition visitor.hh:20