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

Determines whether an Expression is a value or general comparison or both, with a certain operator. More...

#include <qoptimizerblocks_p.h>

Inheritance diagram for QPatternist::ComparisonIdentifier:
QPatternist::ExpressionIdentifier QSharedData

Public Functions

 ComparisonIdentifier (const QVector< Expression::ID > comparatorHosts, const AtomicComparator::Operator op)
 
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 QVector< Expression::IDm_hosts
 
const AtomicComparator::Operator m_op
 

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

Determines whether an Expression is a value or general comparison or both, with a certain operator.

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

Definition at line 120 of file qoptimizerblocks_p.h.

Constructors and Destructors

◆ ComparisonIdentifier()

ComparisonIdentifier::ComparisonIdentifier ( const QVector< Expression::ID comparatorHosts,
const AtomicComparator::Operator  op 
)
Parameters
comparatorHoststhe possible parent that may have the operator. This may be Expression::IDGeneralComparison or Expression::IDValueComparison. The two values may also be OR'd, meaning any of them will do.
opthe operator that the comparator host must have. For example, if op is AtomicComparator::OperatorGreatorOrEqual this ComparisonIdentifier will match operator >= in the case of IDGeneralComparison and 'ge' in the case of IDValueComparison.

Definition at line 66 of file qoptimizerblocks.cpp.

67  : m_hosts(hosts),
68  m_op(op)
69 {
70 }
const QVector< Expression::ID > m_hosts
const AtomicComparator::Operator m_op

Functions

◆ matches()

bool ComparisonIdentifier::matches ( const Expression::Ptr expr) const
virtual
Returns
true, if expr is a ValueComparison with the operator passed in ComparisonIdentifier().

Implements QPatternist::ExpressionIdentifier.

Definition at line 72 of file qoptimizerblocks.cpp.

73 {
74  const Expression::ID eID = e->id();
75 
77  {
79  return e->as<GeneralComparison>()->operatorID() == m_op;
80  else
81  return false;
82  }
83  else if(eID == Expression::IDValueComparison)
84  {
86  return e->as<ValueComparison>()->operatorID() == m_op;
87  else
88  return false;
89  }
90  else
91  return false;
92 }
Implements XPath 2.0&#39;s general comparions, such as the = operator.
AtomicComparator::Operator operatorID() const
const QVector< Expression::ID > m_hosts
const AtomicComparator::Operator m_op
bool contains(const T &t) const
Returns true if the vector contains an occurrence of value; otherwise returns false.
Definition: qvector.h:731
AtomicComparator::Operator operatorID() const
Implements XPath 2.0 value comparions, such as the eq operator.

Properties

◆ m_hosts

const QVector<Expression::ID> QPatternist::ComparisonIdentifier::m_hosts
private

Definition at line 145 of file qoptimizerblocks_p.h.

Referenced by matches().

◆ m_op

const AtomicComparator::Operator QPatternist::ComparisonIdentifier::m_op
private

Definition at line 146 of file qoptimizerblocks_p.h.

Referenced by matches().


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