LibreOffice Module forms (master) 1
|
ComputedExpression represents an XPath Expression and caches results. More...
#include <computedexpression.hxx>
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... | |
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.
xforms::ComputedExpression::ComputedExpression | ( | ) |
Definition at line 46 of file computedexpression.cxx.
xforms::ComputedExpression::~ComputedExpression | ( | ) |
Definition at line 52 of file computedexpression.cxx.
|
protected |
implementation of isSimpleExpression
Definition at line 67 of file computedexpression.cxx.
References i18nutil::SearchOptions2::AlgorithmType2, msExpression, nLength, utl::TextSearch::SearchForward(), and i18nutil::SearchOptions2::searchString.
Referenced by xforms::BoolExpression::setExpression(), setExpression(), and xforms::PathExpression::setExpression().
|
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().
|
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().
|
staticprotected |
obtain a (suitable) XPathAPI implementation
Definition at line 150 of file computedexpression.cxx.
References comphelper::getProcessComponentContext(), i, xforms::EvaluationContext::mxContextNode, xforms::EvaluationContext::mxModel, xforms::EvaluationContext::mxNamespaces, and nCount.
Referenced by _evaluate().
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().
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().
bool xforms::ComputedExpression::getBool | ( | bool | bDefault = false | ) | const |
Definition at line 144 of file computedexpression.cxx.
References mxResult.
Referenced by xforms::Binding::getLocalMIP().
|
inline |
get the expression string
Definition at line 84 of file computedexpression.hxx.
References msExpression.
Referenced by xforms::Binding::bind(), xforms::Submission::doSubmit(), xforms::Binding::explainInvalid(), xforms::Binding::getBindingExpression(), xforms::Binding::getCalculateExpression(), xforms::Binding::getConstraintExpression(), xforms::Binding::getReadonlyExpression(), xforms::Submission::getRef(), xforms::Binding::getRelevantExpression(), and xforms::Binding::getRequiredExpression().
OUString xforms::ComputedExpression::getString | ( | ) | const |
Definition at line 139 of file computedexpression.cxx.
References mxResult.
Referenced by xforms::Binding::bind(), xforms::Binding::explainInvalid(), xforms::Binding::explainInvalid_DataType(), xforms::Binding::getValue(), xforms::Binding::isValid(), and xforms::Binding::isValid_DataType().
|
inline |
Definition at line 113 of file computedexpression.hxx.
References mxResult.
Referenced by xforms::Submission::doSubmit(), and xforms::Model::getResultForExpression().
bool xforms::ComputedExpression::hasValue | ( | ) | const |
does this expression have a value?
Definition at line 127 of file computedexpression.cxx.
References mxResult.
Referenced by _evaluate(), xforms::Binding::explainInvalid(), xforms::Binding::getLocalMIP(), xforms::Binding::getValue(), xforms::Binding::getXNodeList(), xforms::Binding::isValid(), and xforms::Binding::setValue().
|
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().
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().
void xforms::ComputedExpression::setExpression | ( | const OUString & | rExpression | ) |
set a new expression string
Definition at line 57 of file computedexpression.cxx.
References _checkExpression(), mbIsEmpty, mbIsSimple, msExpression, and mxResult.
Referenced by xforms::Submission::doSubmit(), xforms::Model::getResultForExpression(), xforms::Binding::setCalculateExpression(), xforms::BoolExpression::setExpression(), xforms::PathExpression::setExpression(), and xforms::Submission::setRef().
|
private |
is msExpression empty?
Definition at line 53 of file computedexpression.hxx.
Referenced by evaluate(), isEmptyExpression(), isSimpleExpression(), and setExpression().
|
protected |
is msExpression a simple expression?
Definition at line 57 of file computedexpression.hxx.
Referenced by evaluate(), isSimpleExpression(), xforms::BoolExpression::setExpression(), setExpression(), and xforms::PathExpression::setExpression().
|
private |
the expression string
Definition at line 50 of file computedexpression.hxx.
Referenced by _checkExpression(), _getExpressionForEvaluation(), getExpression(), and setExpression().
|
protected |
the result from the last bind
Definition at line 60 of file computedexpression.hxx.
Referenced by _evaluate(), clear(), evaluate(), xforms::PathExpression::evaluate(), getBool(), getString(), xforms::PathExpression::getXNodeList(), getXPath(), hasValue(), and setExpression().