libdrmconf  0.12.0
A library to program DMR radios.
Public Member Functions | Protected Member Functions | List of all members
Visitor Class Reference

Base visitor class for the config tree. More...

#include <visitor.hh>

Inheritance diagram for Visitor:
Inheritance graph
[legend]

Public Member Functions

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 processItem (ConfigItem *item, const ErrorStack &err=ErrorStack())
 Traverses the specified config item. 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

 Visitor ()
 Hidden constructor.
 

Detailed Description

Base visitor class for the config tree.

This class can be used to implement a convenient tree taversal for the entry configuration.

Member Function Documentation

◆ process()

bool Visitor::process ( Config config,
const ErrorStack err = ErrorStack() 
)
virtual

Traverses the properties of the configuration recursively.

Returns
true on success. Error information can be found in the error stack, if passed.

◆ processBool()

bool Visitor::processBool ( ConfigItem item,
const QMetaProperty &  prop,
const ErrorStack err = ErrorStack() 
)
virtual

Handles a boolean typed property.

Parameters
itemSpecifies the config item holding this property.
propSpecifies the property.
errSpecifies the error stack to pass on.

◆ processDouble()

bool Visitor::processDouble ( ConfigItem item,
const QMetaProperty &  prop,
const ErrorStack err = ErrorStack() 
)
virtual

Handles a double precision float typed property.

Parameters
itemSpecifies the config item holding this property.
propSpecifies the property.
errSpecifies the error stack to pass on.

◆ processEnum()

bool Visitor::processEnum ( ConfigItem item,
const QMetaProperty &  prop,
const ErrorStack err = ErrorStack() 
)
virtual

Handles an enum typed property.

Parameters
itemSpecifies the config item holding this property.
propSpecifies the property.
errSpecifies the error stack to pass on.

◆ processFrequency()

bool Visitor::processFrequency ( ConfigItem item,
const QMetaProperty &  prop,
const ErrorStack err = ErrorStack() 
)
virtual

Handles a Frequency typed property.

Parameters
itemSpecifies the config item holding this property.
propSpecifies the property.
errSpecifies the error stack to pass on.

◆ processInt()

bool Visitor::processInt ( ConfigItem item,
const QMetaProperty &  prop,
const ErrorStack err = ErrorStack() 
)
virtual

Handles an integer typed property.

Parameters
itemSpecifies the config item holding this property.
propSpecifies the property.
errSpecifies the error stack to pass on.

◆ processInterval()

bool Visitor::processInterval ( ConfigItem item,
const QMetaProperty &  prop,
const ErrorStack err = ErrorStack() 
)
virtual

Handles a Interval typed property.

Parameters
itemSpecifies the config item holding this property.
propSpecifies the property.
errSpecifies the error stack to pass on.

◆ processItem()

bool Visitor::processItem ( ConfigItem item,
const ErrorStack err = ErrorStack() 
)
virtual

Traverses the specified config item.

This method calls processProperty on all properties of the item.

Reimplemented in ConfigMergeVisitor, ConfigLabelingVisitor, ConfigCloneVisitor, ZoneMergeVisitor, and ZoneSplitVisitor.

◆ processList()

bool Visitor::processList ( AbstractConfigObjectList list,
const ErrorStack err = ErrorStack() 
)
virtual

Traverses the list of objects or references.

If list is a list of ConfigItem, the visitor will traverse those by calling processItem on every of these element. If it is a list of ConfigObjectRef references, the visitor stop here and simply return true. By default, the visitor does not follow references.

Reimplemented in FixReferencesVisistor, ConfigCloneVisitor, ObjectFilterVisitor, and ZoneMergeVisitor.

◆ processProperty()

bool Visitor::processProperty ( ConfigItem item,
const QMetaProperty &  prop,
const ErrorStack err = ErrorStack() 
)
virtual

Processes the specified property of the item.

This method dispatches to the type-specific methods like processEnum, processBool, processInt, processUInt, processDouble, processString, processItem, processReference, processList, and processUnknownType, depending on the type of the property. Do not override this method unless you need to handle all properties differently.

Reimplemented in FixReferencesVisistor, ConfigCloneVisitor, and ObjectFilterVisitor.

◆ processReference()

bool Visitor::processReference ( ConfigObjectReference ref,
const ErrorStack err = ErrorStack() 
)
virtual

Handles references to config objects.

By default, the method will simply return true. The visitor does not follow references.

◆ processString()

bool Visitor::processString ( ConfigItem item,
const QMetaProperty &  prop,
const ErrorStack err = ErrorStack() 
)
virtual

Handles a string typed property.

Parameters
itemSpecifies the config item holding this property.
propSpecifies the property.
errSpecifies the error stack to pass on.

◆ processUInt()

bool Visitor::processUInt ( ConfigItem item,
const QMetaProperty &  prop,
const ErrorStack err = ErrorStack() 
)
virtual

Handles an unsigned integer typed property.

Parameters
itemSpecifies the config item holding this property.
propSpecifies the property.
errSpecifies the error stack to pass on.

◆ processUnknownType()

bool Visitor::processUnknownType ( ConfigItem item,
const QMetaProperty &  prop,
const ErrorStack err = ErrorStack() 
)
virtual

Handles a property of unknown type.

Returns always false.

Parameters
itemSpecifies the config item holding this property.
propSpecifies the property.
errSpecifies the error stack to pass on.

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