Qt 4.8
|
Contains functionality for functions and expressions that uses regular expressions. More...
#include <qpatternplatform_p.h>
Static Public Functions | |
static QRegExp | parsePattern (const QString &pattern, const ReportContext::Ptr &context, const SourceLocationReflection *const location) |
Parses pattern. More... | |
Static Public Functions inherited from QPatternist::Expression | |
static void | rewrite (Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context) |
Protected Functions | |
PatternPlatform (const qint8 flagsPosition) | |
This constructor is protected, because this class is supposed to be sub-classed. More... | |
Protected Functions inherited from QPatternist::UnlimitedContainer | |
template<CardinalityComputation suppliedCard> | |
SequenceType::Ptr | operandsUnionType () const |
Protected Functions inherited from QPatternist::Expression | |
void | typeCheckOperands (const StaticContext::Ptr &context) |
Protected Functions inherited from QPatternist::CppCastingHelper< Expression > | |
CppCastingHelper () | |
Private Types | |
enum | PreCompiledPart { NoPart = 0, PatternPrecompiled = 1, FlagsPrecompiled = 2, FlagsAndPattern = PatternPrecompiled | FlagsPrecompiled } |
typedef QFlags< PreCompiledPart > | PreCompiledParts |
Private Functions | |
Flags | parseFlags (const QString &flags, const DynamicContext::Ptr &context) const |
QRegExp | parsePattern (const QString &pattern, const ReportContext::Ptr &context) const |
Calls the public parsePattern() function and passes in this as the location. More... | |
Static Private Functions | |
static void | applyFlags (const Flags flags, QRegExp &pattern) |
Properties | |
PreCompiledParts | m_compiledParts |
Flags | m_flags |
const qint8 | m_flagsPosition |
QRegExp | m_pattern |
Additional Inherited Members | |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
Protected Variables inherited from QPatternist::UnlimitedContainer | |
Expression::List | m_operands |
Contains functionality for functions and expressions that uses regular expressions.
Definition at line 73 of file qpatternplatform_p.h.
Definition at line 107 of file qpatternplatform_p.h.
|
private |
Definition at line 155 of file qpatternplatform_p.h.
Enumerator | |
---|---|
NoFlags | No flags are set. Default behavior is used. |
DotAllMode | Flag |
MultiLineMode | Flag |
CaseInsensitive | Flag |
SimplifyWhitespace | Flag |
Definition at line 80 of file qpatternplatform_p.h.
|
private |
Enum telling whether the flags, pattern, or both have been compiled at compile time.
Enumerator | |
---|---|
NoPart | |
PatternPrecompiled | |
FlagsPrecompiled | |
FlagsAndPattern |
Definition at line 147 of file qpatternplatform_p.h.
|
protected |
This constructor is protected, because this class is supposed to be sub-classed.
flagsPosition | an index position specifying the operand containing the pattern flags. |
Definition at line 112 of file qpatternplatform.cpp.
Definition at line 158 of file qpatternplatform.cpp.
Referenced by compress(), and pattern().
|
inline |
If the pattern isn't precompiled, -1 is returned.
Definition at line 180 of file qpatternplatform_p.h.
Referenced by QPatternist::ReplaceFN::compress().
|
virtual |
compress() is the last stage performs in compiling an expression, done after the initial AST build and calling typeCheck(). compress() performs crucial simplifications, either by having drastic performance implications or that some expressions depend on it for proper behavior.
The default implementation performs a sparse conditional constant propagation. In short, a recursive process is performed in the AST which examines if the Expression's operands are constant values, and if so, performs a const fold(AST rewrite) into the result of evaluating the expression in question. This default behavior can be disabled by letting properties() return DisableElimination.
This compress() stage can be relative effective due to the design of XPath, in part because intrinsic functions are heavily used. Many Expressions override compress() and do optimizations specific to what they do. Also, many Expressions performs optimizations in their typeCheck().
context | the static context. Supplies compile time information, and is the channel for communicating error messages. |
Reimplemented from QPatternist::Expression.
Reimplemented in QPatternist::ReplaceFN.
Definition at line 265 of file qpatternplatform.cpp.
Referenced by QPatternist::ReplaceFN::compress().
|
private |
Definition at line 213 of file qpatternplatform.cpp.
Referenced by compress(), and pattern().
|
static |
Parses pattern.
Definition at line 177 of file qpatternplatform.cpp.
Referenced by QPatternist::XsdSchemaChecker::checkConstrainingFacets(), QPatternist::XsdTypeChecker::checkConstrainingFacetsBoolean(), QPatternist::XsdTypeChecker::checkConstrainingFacetsDateTime(), QPatternist::XsdTypeChecker::checkConstrainingFacetsDouble(), QPatternist::XsdTypeChecker::checkConstrainingFacetsDuration(), QPatternist::XsdTypeChecker::checkConstrainingFacetsList(), QPatternist::XsdTypeChecker::checkConstrainingFacetsQName(), QPatternist::XsdTypeChecker::checkConstrainingFacetsSignedInteger(), QPatternist::XsdTypeChecker::checkConstrainingFacetsString(), QPatternist::XsdTypeChecker::checkConstrainingFacetsUnion(), QPatternist::XsdTypeChecker::checkConstrainingFacetsUnsignedInteger(), compress(), parsePattern(), and pattern().
|
inlineprivate |
Calls the public parsePattern() function and passes in this
as the location.
Definition at line 171 of file qpatternplatform.cpp.
const QRegExp PatternPlatform::pattern | ( | const DynamicContext::Ptr & | context | ) | const |
Retrieves the pattern supplied in the arguments, taking care of compiling it, settings its flags, and everything else required for getting it ready to use. If an error occurs, an appropriate error is raised via context
.
Definition at line 118 of file qpatternplatform.cpp.
Referenced by QPatternist::TokenizeFN::evaluateSequence(), QPatternist::MatchesFN::evaluateSingleton(), and QPatternist::ReplaceFN::evaluateSingleton().
|
private |
The parts that have been pre-compiled at compile time.
Definition at line 174 of file qpatternplatform_p.h.
Referenced by captureCount(), compress(), and pattern().
|
private |
Definition at line 175 of file qpatternplatform_p.h.
Referenced by compress(), and pattern().
|
private |
Definition at line 177 of file qpatternplatform_p.h.
Referenced by compress(), and pattern().
|
private |
Definition at line 176 of file qpatternplatform_p.h.
Referenced by captureCount(), compress(), and pattern().