Qt 4.8
Public Functions | Properties | List of all members
QPatternist::IntegerIdentifier Class Reference

Matches numeric literals that are of type xs:integer and has a specific value. More...

#include <qoptimizerblocks_p.h>

Inheritance diagram for QPatternist::IntegerIdentifier:
QPatternist::ExpressionIdentifier QSharedData

Public Functions

 IntegerIdentifier (const xsInteger num)
 
virtual bool matches (const Expression::Ptr &expr) const
 
- Public Functions inherited from QPatternist::ExpressionIdentifier
 ExpressionIdentifier ()
 
virtual ~ExpressionIdentifier ()
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 

Properties

const xsInteger m_num
 

Additional Inherited Members

- Public Types inherited from QPatternist::ExpressionIdentifier
typedef QList< ExpressionIdentifier::PtrList
 
typedef QExplicitlySharedDataPointer< ExpressionIdentifierPtr
 
- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Matches numeric literals that are of type xs:integer and has a specific value.

For example IntegerIdentifier(4) would match the former but not the latter operand in this expression: "4 + 5".

Author
Frans englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 159 of file qoptimizerblocks_p.h.

Constructors and Destructors

◆ IntegerIdentifier()

IntegerIdentifier::IntegerIdentifier ( const xsInteger  num)

Definition at line 108 of file qoptimizerblocks.cpp.

108  : m_num(num)
109 {
110 }

Functions

◆ matches()

bool IntegerIdentifier::matches ( const Expression::Ptr expr) const
virtual
Parameters
exprthe Expression to be tested. This is guranteed to always be a non null, valid pointer.
Returns
true if expr matches as according to this ExpressionIdentifier, otherwise false.

Implements QPatternist::ExpressionIdentifier.

Definition at line 112 of file qoptimizerblocks.cpp.

113 {
114  return expr->is(Expression::IDIntegerValue) &&
115  expr->as<Literal>()->item().as<Numeric>()->toInteger() == m_num;
116 }
const TCastTarget * as() const
Houses an AtomicValue, making it available as an Expression.
Definition: qliteral_p.h:74
Base class for all numeric values.
bool is(const ID id) const

Properties

◆ m_num

const xsInteger QPatternist::IntegerIdentifier::m_num
private

Definition at line 166 of file qoptimizerblocks_p.h.

Referenced by matches().


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