NuriaProject Framework  0.1
The NuriaProject Framework
Public Member Functions | List of all members
Nuria::LazyConditionWalker Class Reference

The LazyConditionWalker class lets you walk over a LazyCondition tree to make modifications to it. More...

#include <lazyconditionwalker.hpp>

Public Member Functions

 LazyConditionWalker ()
 
 LazyConditionWalker (const LazyConditionWalker &other)
 
 ~LazyConditionWalker ()
 
void onCondition (LazyCondition::Type type, const Callback &method)
 
void onField (int fieldType, const Callback &method)
 
void onVariant (int userType, const Callback &method)
 
LazyConditionWalkeroperator= (const LazyConditionWalker &other)
 
LazyCondition walk (const LazyCondition &condition, bool walkArguments=false)
 

Detailed Description

The LazyConditionWalker class lets you walk over a LazyCondition tree to make modifications to it.

Using the on* methods, you can register handler methods. That method will be passed two arguments: First a QVariantList, which contains the stack to the particular item, the last element being the item itself. Second, the item itself.

The method may return a value, which will replace the previous value. Further checks don't take place on validity, so make sure that your result is legal in the position.

All nodes are walked depth-first. Children of a returned item are skipped.

Constructor & Destructor Documentation

Nuria::LazyConditionWalker::LazyConditionWalker ( )

Constructs a empty walker.

Nuria::LazyConditionWalker::LazyConditionWalker ( const LazyConditionWalker other)

Copy constructor.

Nuria::LazyConditionWalker::~LazyConditionWalker ( )

Destructor.

Member Function Documentation

void Nuria::LazyConditionWalker::onCondition ( LazyCondition::Type  type,
const Callback method 
)

Registers method as handler for conditions of type.

Note
There can only be one handler for type. If there is already one, then it will be replaced by method.
void Nuria::LazyConditionWalker::onField ( int  fieldType,
const Callback method 
)

Registers method as handler for fields of fieldType. This also works with custom types.

Note
There can only be one handler for fieldType. If there is already one, then it will be replaced by method.
void Nuria::LazyConditionWalker::onVariant ( int  userType,
const Callback method 
)

Register method as handler for variants of type userType.

Registering a handler for LazyCondition or Field has no effect.

Note
There can only be one handler for userType. If there is already one, then it will be replaced by method.
LazyConditionWalker& Nuria::LazyConditionWalker::operator= ( const LazyConditionWalker other)

Assignment operator.

LazyCondition Nuria::LazyConditionWalker::walk ( const LazyCondition condition,
bool  walkArguments = false 
)

Walks over condition and returns the resulting condition.

When passing true for walkArguments, arguments of TestCalls are also visited. Be aware that this feature increases the complexity.

See also
onCondition onField

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