LibreOffice Module forms (master) 1
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes | List of all members
xforms::ComputedExpression Class Reference

ComputedExpression represents an XPath Expression and caches results. More...

#include <computedexpression.hxx>

Inheritance diagram for xforms::ComputedExpression:
[legend]

Public Member Functions

 ComputedExpression ()
 
 ~ComputedExpression ()
 
const OUString & getExpression () const
 get the expression string More...
 
void setExpression (const OUString &rExpression)
 set a new expression string More...
 
bool isEmptyExpression () const
 do we have an actual expression? More...
 
bool isSimpleExpression () const
 heuristically determine whether this expression is 'simple', i.e. More...
 
bool evaluate (const xforms::EvaluationContext &rContext)
 evaluate the expression relative to the content node. More...
 
bool hasValue () const
 does this expression have a value? More...
 
void clear ()
 remove value/evaluate results More...
 
css::uno::Reference< css::xml::xpath::XXPathObject > const & getXPath () const
 
bool getBool (bool bDefault=false) const
 
OUString getString () const
 

Protected Member Functions

bool _checkExpression (const char *pExpression) const
 implementation of isSimpleExpression More...
 
const OUString & _getExpressionForEvaluation () const
 allow manipulation of the expression before it is evaluated More...
 
bool _evaluate (const xforms::EvaluationContext &rContext, const OUString &sExpression)
 evaluate the expression relative to the content node. More...
 

Static Protected Member Functions

static css::uno::Reference< css::xml::xpath::XXPathAPI > _getXPathAPI (const xforms::EvaluationContext &aContext)
 obtain a (suitable) XPathAPI implementation More...
 

Protected Attributes

bool mbIsSimple
 is msExpression a simple expression? More...
 
css::uno::Reference< css::xml::xpath::XXPathObject > mxResult
 the result from the last bind More...
 

Private Attributes

OUString msExpression
 the expression string More...
 
bool mbIsEmpty
 is msExpression empty? More...
 

Detailed Description

ComputedExpression represents an XPath Expression and caches results.

As this class has no virtual methods, it should never be used polymorphically.

Definition at line 47 of file computedexpression.hxx.

Constructor & Destructor Documentation

◆ ComputedExpression()

xforms::ComputedExpression::ComputedExpression ( )

Definition at line 46 of file computedexpression.cxx.

◆ ~ComputedExpression()

xforms::ComputedExpression::~ComputedExpression ( )

Definition at line 52 of file computedexpression.cxx.

Member Function Documentation

◆ _checkExpression()

bool xforms::ComputedExpression::_checkExpression ( const char *  pExpression) const
protected

◆ _evaluate()

bool xforms::ComputedExpression::_evaluate ( const xforms::EvaluationContext rContext,
const OUString &  sExpression 
)
protected

evaluate the expression relative to the content node.

Definition at line 95 of file computedexpression.cxx.

References _getXPathAPI(), Exception, hasValue(), xforms::EvaluationContext::mxContextNode, and mxResult.

Referenced by evaluate(), and xforms::PathExpression::evaluate().

◆ _getExpressionForEvaluation()

const OUString & xforms::ComputedExpression::_getExpressionForEvaluation ( ) const
inlineprotected

allow manipulation of the expression before it is evaluated

Definition at line 68 of file computedexpression.hxx.

References msExpression.

Referenced by xforms::PathExpression::_getExpressionForEvaluation(), and evaluate().

◆ _getXPathAPI()

Reference< XXPathAPI > xforms::ComputedExpression::_getXPathAPI ( const xforms::EvaluationContext aContext)
staticprotected

◆ clear()

void xforms::ComputedExpression::clear ( )

remove value/evaluate results

Definition at line 133 of file computedexpression.cxx.

References mxResult.

Referenced by xforms::Binding::clear(), and xforms::Binding::update().

◆ evaluate()

bool xforms::ComputedExpression::evaluate ( const xforms::EvaluationContext rContext)

evaluate the expression relative to the content node.

Definition at line 116 of file computedexpression.cxx.

References _evaluate(), _getExpressionForEvaluation(), mbIsEmpty, mbIsSimple, and mxResult.

Referenced by xforms::Binding::bind(), xforms::Submission::doSubmit(), and xforms::Model::getResultForExpression().

◆ getBool()

bool xforms::ComputedExpression::getBool ( bool  bDefault = false) const

Definition at line 144 of file computedexpression.cxx.

References mxResult.

Referenced by xforms::Binding::getLocalMIP().

◆ getExpression()

const OUString & xforms::ComputedExpression::getExpression ( ) const
inline

◆ getString()

OUString xforms::ComputedExpression::getString ( ) const

◆ getXPath()

css::uno::Reference< css::xml::xpath::XXPathObject > const & xforms::ComputedExpression::getXPath ( ) const
inline

◆ hasValue()

bool xforms::ComputedExpression::hasValue ( ) const

◆ isEmptyExpression()

bool xforms::ComputedExpression::isEmptyExpression ( ) const
inline

do we have an actual expression?

Definition at line 90 of file computedexpression.hxx.

References mbIsEmpty.

Referenced by xforms::Binding::bind(), xforms::Binding::getLocalMIP(), and xforms::Binding::isUseful().

◆ isSimpleExpression()

bool xforms::ComputedExpression::isSimpleExpression ( ) const

heuristically determine whether this expression is 'simple', i.e.

whether its value will change depending on the values of other nodes

Definition at line 88 of file computedexpression.cxx.

References mbIsEmpty, and mbIsSimple.

Referenced by xforms::PathExpression::evaluate(), xforms::Binding::isSimpleBinding(), and xforms::Binding::isSimpleBindingExpression().

◆ setExpression()

void xforms::ComputedExpression::setExpression ( const OUString &  rExpression)

Member Data Documentation

◆ mbIsEmpty

bool xforms::ComputedExpression::mbIsEmpty
private

is msExpression empty?

Definition at line 53 of file computedexpression.hxx.

Referenced by evaluate(), isEmptyExpression(), isSimpleExpression(), and setExpression().

◆ mbIsSimple

bool xforms::ComputedExpression::mbIsSimple
protected

◆ msExpression

OUString xforms::ComputedExpression::msExpression
private

the expression string

Definition at line 50 of file computedexpression.hxx.

Referenced by _checkExpression(), _getExpressionForEvaluation(), getExpression(), and setExpression().

◆ mxResult

css::uno::Reference<css::xml::xpath::XXPathObject> xforms::ComputedExpression::mxResult
protected

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