Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berry::ExpressionConverter Class Reference

#include <berryExpressionConverter.h>

Public Member Functions

 ExpressionConverter (const QList< SmartPointer< ElementHandler > > &handlers)
 
SmartPointer< ExpressionPerform (const SmartPointer< IConfigurationElement > &root)
 
SmartPointer< ExpressionPerform (Poco::XML::Element *root)
 
void ProcessChildren (const SmartPointer< IConfigurationElement > &element, const SmartPointer< CompositeExpression > &result)
 
QString GetDebugPath (const SmartPointer< IConfigurationElement > &configurationElement)
 
void ProcessChildren (Poco::XML::Element *element, const SmartPointer< CompositeExpression > &result)
 

Static Public Member Functions

static ExpressionConverterGetDefault ()
 

Detailed Description

An expression converter converts an XML expression represented by an IConfigurationElement or Element (DOM) subtree into a corresponding expression tree.

An expression converter manages a list of ElementHandlers. Element handlers are responsible to do the actual conversion. The element handlers build a chain of responsibility.

Since
3.0

Definition at line 53 of file berryExpressionConverter.h.

Constructor & Destructor Documentation

berry::ExpressionConverter::ExpressionConverter ( const QList< SmartPointer< ElementHandler > > &  handlers)

Creates a new expression converter with the given list of element handlers. The element handlers build a chain of responsibility meaning that the first handler in the list is first used to convert the configuration element. If this handler isn't able to convert the configuration element the next handler in the array is used.

Parameters
handlersthe array of element handlers

Definition at line 52 of file berryExpressionConverter.cpp.

Referenced by GetDefault().

Member Function Documentation

QString berry::ExpressionConverter::GetDebugPath ( const SmartPointer< IConfigurationElement > &  configurationElement)
ExpressionConverter * berry::ExpressionConverter::GetDefault ( )
static

Returns the default expression converter. The default expression converter can cope with all expression elements defined by the common expression language.

Returns
the default expression converter

Definition at line 41 of file berryExpressionConverter.cpp.

References ExpressionConverter(), and berry::ElementHandler::GetDefault().

SmartPointer<Expression> berry::ExpressionConverter::Perform ( const SmartPointer< IConfigurationElement > &  root)

Converts the tree of configuration elements represented by the given root element and returns a corresponding expression tree.

Parameters
rootthe configuration element to be converted
Returns
the corresponding expression tree or null if the configuration element cannot be converted
Exceptions
CoreExceptionif the configuration element can't be converted. Reasons include: (a) no handler is available to cope with a certain configuration element or (b) the XML expression tree is malformed.
Expression::Pointer berry::ExpressionConverter::Perform ( Poco::XML::Element *  root)

Converts the tree of DOM elements represented by the given root element and returns a corresponding expression tree.

Parameters
rootthe element to be converted
Returns
the corresponding expression tree or null if the element cannot be converted
Exceptions
CoreExceptionif the element can't be converted. Reasons include: (a) no handler is available to cope with a certain element or (b) the XML expression tree is malformed.

Definition at line 70 of file berryExpressionConverter.cpp.

References berry::SmartPointer< TObjectType >::IsNull().

void berry::ExpressionConverter::ProcessChildren ( const SmartPointer< IConfigurationElement > &  element,
const SmartPointer< CompositeExpression > &  result 
)
void berry::ExpressionConverter::ProcessChildren ( Poco::XML::Element *  element,
const SmartPointer< CompositeExpression > &  result 
)

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