pwfengine
Signals | Public Member Functions
PFindSchemaElement Class Reference

Given a number of possible alternatives, emit a status success with the valid schema element for the given wrapper, status failure otherwise. More...

#include <PFindSchemaElement.h>

Inheritance diagram for PFindSchemaElement:
PAction

List of all members.

Signals

void found (const PSchemaElement &)

Public Member Functions

 PFindSchemaElement (PWrapperElement &from, const QString &elementType, const QString &elementName="", QObject *parent=NULL)
PWrapperElementfrom () const
QString elementType () const
QString elementName () const
void start ()
void setSharedSchemaElement (const PSchemaElement &schemaElement)
PSchemaElement foundSchemaElement () const

Detailed Description

Given a number of possible alternatives, emit a status success with the valid schema element for the given wrapper, status failure otherwise.

This class is actually used as a tree of action groups, each path from the root to a leaf being an alternative for the given schema element. Each tree node can contains both another instances of this class or a number of require parser, but not mixed. The first type of nodes represents a schema <switch> (switch action), while the second a <case> (case action). The case action must have the success schema element, e.g the schema element that is valid if all the requires are evaluated succesfully. The switch action could only have the shared schema element, e.g the schema element that is valid if all its child case actions fail, if it's not specified, the action will just emit a status failure.

This class is actually used as a growing tree of finders, each of them starting its search from a descendent/ancestor of the schema element to find. The schema is visited in some way, at each step the element is searched and the encountered requires are evaluated, continuing the visit if needed.

If the visit ends without having found the element, the search continues in the parent schema by using a top-down visit, continuing to going up to the parent schemas until possible or needed.


Constructor & Destructor Documentation

PFindSchemaElement::PFindSchemaElement ( PWrapperElement from,
const QString &  elementType,
const QString &  elementName = "",
QObject *  parent = NULL 
)

Used to find an element by specifying its type and name. The "from" schema is visited in a top-down fashion: at each step, the element is searched and saved and the requires evaluation took place, if it fails, then the finder fails too, otherwise, new finders for each child case and switch schema element are created; the found element will be that of the first child finder to have succeded, or if they all fail, the previously saved element, otherwise, if no element is saved, the find action will fail.


Member Function Documentation

QString PFindSchemaElement::elementName ( ) const
Returns:
the name of the element to find
QString PFindSchemaElement::elementType ( ) const
Returns:
the type of the element to find
PWrapperElement & PFindSchemaElement::from ( ) const

Used to find the element that is referenced by the specified reference element. The search goes by alternating top-down searches in the parent siblings and checks (for the element) on the parent, i.e. visiting the tree like an incremental fountain's jet.

Returns:
m_startingSchemaElement
void PFindSchemaElement::start ( ) [virtual]

Start the execution of the action and immediately emit the started signal.

Reimplemented from PAction.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Enumerator