Qt 4.8
qt-4.8.6
src
xmlpatterns
expr
qexpressionvariablereference.cpp
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
#include "
qexpressionvariablereference_p.h
"
44
45
QT_BEGIN_NAMESPACE
46
47
using namespace
QPatternist
;
48
49
ExpressionVariableReference::ExpressionVariableReference
(
const
VariableSlotID
slotP,
50
const
VariableDeclaration
*varDecl) :
VariableReference
(slotP)
51
, m_varDecl(varDecl)
52
{
53
}
54
55
bool
ExpressionVariableReference::evaluateEBV
(
const
DynamicContext::Ptr
&context)
const
56
{
57
return
context->
expressionVariable
(
slot
())->
evaluateEBV
(context);
58
}
59
60
Item
ExpressionVariableReference::evaluateSingleton
(
const
DynamicContext::Ptr
&context)
const
61
{
62
return
context->
expressionVariable
(
slot
())->
evaluateSingleton
(context);
63
}
64
65
Item::Iterator::Ptr
ExpressionVariableReference::evaluateSequence
(
const
DynamicContext::Ptr
&context)
const
66
{
67
return
context->
expressionVariable
(
slot
())->
evaluateSequence
(context);
68
}
69
Expression::Ptr
ExpressionVariableReference::typeCheck
(
const
StaticContext::Ptr
&context,
70
const
SequenceType::Ptr
&reqType)
71
{
72
if
(
m_varDecl
->
canSourceRewrite
)
73
return
m_varDecl
->
expression
()->
typeCheck
(context, reqType);
74
else
75
return
VariableReference::typeCheck
(context, reqType);
76
}
77
78
Expression::ID
ExpressionVariableReference::id
()
const
79
{
80
return
IDExpressionVariableReference
;
81
}
82
83
ExpressionVisitorResult::Ptr
ExpressionVariableReference::accept
(
const
ExpressionVisitor::Ptr
&visitor)
const
84
{
85
return
visitor->visit(
this
);
86
}
87
88
SequenceType::Ptr
ExpressionVariableReference::staticType
()
const
89
{
90
return
m_varDecl
->
expression
()->
staticType
();
91
}
92
93
QT_END_NAMESPACE
QPatternist::VariableSlotID
qint32 VariableSlotID
Definition:
qprimitives_p.h:139
QPatternist::ExpressionVariableReference::evaluateSequence
virtual Item::Iterator::Ptr evaluateSequence(const DynamicContext::Ptr &context) const
Definition:
qexpressionvariablereference.cpp:65
QPatternist::ExpressionVariableReference::typeCheck
virtual Expression::Ptr typeCheck(const StaticContext::Ptr &context, const SequenceType::Ptr &reqType)
Definition:
qexpressionvariablereference.cpp:69
QT_END_NAMESPACE
#define QT_END_NAMESPACE
This macro expands to.
Definition:
qglobal.h:90
QPatternist::VariableDeclaration
Represents a declared variable. Only used at the compilation stage.
Definition:
qvariabledeclaration_p.h:77
QPatternist::ExpressionVariableReference::ExpressionVariableReference
ExpressionVariableReference(const VariableSlotID slot, const VariableDeclaration *varDecl)
Definition:
qexpressionvariablereference.cpp:49
QPatternist::Expression::evaluateEBV
virtual bool evaluateEBV(const DynamicContext::Ptr &context) const
Definition:
qexpression.cpp:315
QExplicitlySharedDataPointer< DynamicContext >
QPatternist::ExpressionVariableReference::evaluateSingleton
virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const
Definition:
qexpressionvariablereference.cpp:60
QPatternist::Expression::typeCheck
virtual Expression::Ptr typeCheck(const StaticContext::Ptr &context, const SequenceType::Ptr &reqType)
Definition:
qexpression.cpp:70
QPatternist::VariableDeclaration::canSourceRewrite
bool canSourceRewrite
Whether a reference can rewrite itself to expression().
Definition:
qvariabledeclaration_p.h:177
QPatternist::ExpressionVariableReference::staticType
virtual SequenceType::Ptr staticType() const
Definition:
qexpressionvariablereference.cpp:88
QPatternist::ExpressionVariableReference::m_varDecl
const VariableDeclaration * m_varDecl
Definition:
qexpressionvariablereference_p.h:95
QPatternist::ExpressionVariableReference::accept
virtual ExpressionVisitorResult::Ptr accept(const ExpressionVisitor::Ptr &visitor) const
Definition:
qexpressionvariablereference.cpp:83
QPatternist::Expression::IDExpressionVariableReference
Definition:
qexpression_p.h:447
qexpressionvariablereference_p.h
QPatternist::VariableReference::slot
VariableSlotID slot() const
Definition:
qvariablereference_p.h:110
QT_BEGIN_NAMESPACE
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition:
qglobal.h:89
QPatternist
The namespace for the internal API of QtXmlPatterns.
Definition:
qacceliterators_p.h:62
QPatternist::ExpressionVariableReference::id
virtual ID id() const
Definition:
qexpressionvariablereference.cpp:78
QPatternist::DynamicContext::expressionVariable
virtual QExplicitlySharedDataPointer< Expression > expressionVariable(const VariableSlotID slot) const =0
QPatternist::Expression::staticType
virtual SequenceType::Ptr staticType() const =0
QPatternist::Item
Represents an item in the XPath 2.0 Data Model.
Definition:
qitem_p.h:182
QPatternist::ExpressionVariableReference::evaluateEBV
virtual bool evaluateEBV(const DynamicContext::Ptr &context) const
Definition:
qexpressionvariablereference.cpp:55
QPatternist::VariableReference
Baseclass for classes being references to variables.
Definition:
qvariablereference_p.h:71
QPatternist::Expression::ID
ID
Definition:
qexpression_p.h:365
QPatternist::VariableDeclaration::expression
const Expression::Ptr & expression() const
Definition:
qvariabledeclaration_p.h:135
QPatternist::Expression::evaluateSingleton
virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const
Definition:
qexpression.cpp:310
QPatternist::Expression::evaluateSequence
virtual Item::Iterator::Ptr evaluateSequence(const DynamicContext::Ptr &context) const
Definition:
qexpression.cpp:300
Qt 4.8 Source Code Browser