Qt 4.8
qorderby_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 //
43 // W A R N I N G
44 // -------------
45 //
46 // This file is not part of the Qt API. It exists purely as an
47 // implementation detail. This header file may change from version to
48 // version without notice, or even be removed.
49 //
50 // We mean it.
51 
52 #ifndef Patternist_OrderBy_H
53 #define Patternist_OrderBy_H
54 
55 #include "qatomiccomparator_p.h"
56 #include "qcomparisonplatform_p.h"
57 #include "qsinglecontainer_p.h"
58 
60 
62 
63 namespace QPatternist
64 {
65  class ReturnOrderBy;
66 
76  class OrderBy : public SingleContainer
77  {
78  public:
79  enum Stability
80  {
83  };
84 
88  class OrderSpec : public ComparisonPlatform<OrderBy::OrderSpec,
89  true, /* Yes, issue errors. */
90  AtomicComparator::AsValueComparison>
91  {
92  public:
97 
99 
101  {
104  };
105 
109  inline OrderSpec()
110  {
111  }
112 
113  inline OrderSpec(const Direction dir,
114  const StaticContext::OrderingEmptySequence orderingEmpty) : direction(dir),
115  orderingEmptySequence(orderingEmpty)
116  {
117  }
118 
119  void prepare(const Expression::Ptr &source,
120  const StaticContext::Ptr &context);
121 
123  {
124  return m_expr.data();
125  }
126 
127  private:
129 
130  public:
136 
138 
140  {
141  return orderingEmptySequence == StaticContext::Least ? AtomicComparator::OperatorLessThanNaNLeast
143  }
144 
145  };
146 
147  OrderBy(const Stability stability,
148  const OrderSpec::Vector &orderSpecs,
149  const Expression::Ptr &operand,
150  ReturnOrderBy *const returnOrderBy);
151 
152  virtual Item::Iterator::Ptr evaluateSequence(const DynamicContext::Ptr &context) const;
153  virtual SequenceType::Ptr staticType() const;
154  virtual Expression::Ptr typeCheck(const StaticContext::Ptr &context,
155  const SequenceType::Ptr &reqType);
156  virtual Expression::Ptr compress(const StaticContext::Ptr &context);
158  virtual ExpressionVisitorResult::Ptr accept(const ExpressionVisitor::Ptr &visitor) const;
159 
160  inline Item::Iterator::Ptr mapToSequence(const Item &i,
161  const DynamicContext::Ptr &context) const;
162  virtual Properties properties() const;
163 
164  private:
169 
173  };
174 
175  /* TODO Q_DECLARE_TYPEINFO(OrderBy::OrderSpec, Q_MOVABLE_TYPE); Breaks,
176  * probably because it's nested. */
177 }
178 
180 
182 
183 #endif
QVector< OrderSpec > Vector
Definition: qorderby_p.h:98
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
Item::Iterator::Ptr mapToSequence(const Item &i, const DynamicContext::Ptr &context) const
Definition: qorderby.cpp:168
const Stability m_stability
Definition: qorderby_p.h:170
virtual Properties properties() const
Definition: qorderby.cpp:226
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
Together with OrderBy, it implements XQuery 1.0&#39;s order by expression.
ReturnOrderBy *const m_returnOrderBy
Definition: qorderby_p.h:172
OrderSpec()
Default constructor, which is needed by QVector.
Definition: qorderby_p.h:109
virtual Item::Iterator::Ptr evaluateSequence(const DynamicContext::Ptr &context) const
Definition: qorderby.cpp:174
AtomicComparator::Operator operatorID() const
Definition: qorderby_p.h:139
const SourceLocationReflection * actualReflection() const
Definition: qorderby_p.h:122
Performs the sorting by being a parent to ForClause.
Definition: qorderby_p.h:76
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145
virtual SequenceType::List expectedOperandTypes() const
Definition: qorderby.cpp:248
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
StaticContext::OrderingEmptySequence orderingEmptySequence
Definition: qorderby_p.h:137
QExplicitlySharedDataPointer< const OrderBy > ConstPtr
Definition: qorderby_p.h:168
OrderSpec::Vector m_orderSpecs
Definition: qorderby_p.h:171
void prepare(const Expression::Ptr &source, const StaticContext::Ptr &context)
Definition: qorderby.cpp:69
The namespace for the internal API of QtXmlPatterns.
virtual SequenceType::Ptr staticType() const
Definition: qorderby.cpp:243
virtual ExpressionVisitorResult::Ptr accept(const ExpressionVisitor::Ptr &visitor) const
Definition: qorderby.cpp:256
Represents an item in the XPath 2.0 Data Model.
Definition: qitem_p.h:182
OrderBy(const Stability stability, const OrderSpec::Vector &orderSpecs, const Expression::Ptr &operand, ReturnOrderBy *const returnOrderBy)
Definition: qorderby.cpp:58
virtual Expression::Ptr typeCheck(const StaticContext::Ptr &context, const SequenceType::Ptr &reqType)
Definition: qorderby.cpp:197
virtual Expression::Ptr compress(const StaticContext::Ptr &context)
Definition: qorderby.cpp:231
Provides comparison functionality for classes that compare Items, such as ValueComparison or MaxFN...
The QFlags class provides a type-safe way of storing OR-combinations of enum values.
Definition: qglobal.h:2313
#define QT_END_HEADER
Definition: qglobal.h:137
OrderSpec(const Direction dir, const StaticContext::OrderingEmptySequence orderingEmpty)
Definition: qorderby_p.h:113
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
Base class for all instances that represents something at a certain location.
Base class for expressions that has exactly one operand.