1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the test suite of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
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 The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#ifndef PatternistSDK_ASTItem_H
30#define PatternistSDK_ASTItem_H
31
32#include <QList>
33#include <QString>
34
35#include "TreeItem.h"
36#include "Global.h"
37
38QT_BEGIN_NAMESPACE
39
40namespace QPatternistSDK
41{
42 /**
43 * @short Is a node in a ASTItem tree; each ASTItem contains
44 * debug information about an QPatternist::Expression.
45 *
46 * ASTItem, by implementing TreeItem, leverages debug data about QPatternist::Expression
47 * instances into Qt's model/view framework.
48 *
49 * @ingroup PatternistSDK
50 * @author Frans Englich <frans.englich@nokia.com>
51 */
52 class ASTItem : public TreeItem
53 {
54 public:
55 virtual ~ASTItem();
56 ASTItem(ASTItem *parent,
57 const QString &name,
58 const QString &details = QString(),
59 const QString &staticType = QString(),
60 const QString &reqType = QString());
61
62 virtual void appendChild(TreeItem *item);
63 virtual TreeItem *child(const unsigned int row) const;
64 virtual unsigned int childCount() const;
65 virtual QVariant data(const Qt::ItemDataRole role, int column) const;
66 virtual TreeItem::List children() const;
67 virtual TreeItem *parent() const;
68 int columnCount() const;
69
70 /**
71 * Returns a string representation of this AST node, recursively including
72 * children. For example, the query <tt>1 eq number()</tt> would result in the string:
73 *
74@verbatim
75ValueComparison(eq)
76 xs:integer(0)
77 FunctionCall(fn:number)
78 ContextItem
79@endverbatim
80 */
81 QString toString() const;
82
83 private:
84 QString toString(const QString &indent) const;
85
86 const QString m_name;
87 const QString m_details;
88 const QString m_reqType;
89 const QString m_staticType;
90 TreeItem::List m_children;
91 TreeItem *m_parent;
92 };
93}
94
95QT_END_NAMESPACE
96
97#endif
98// vim: et:ts=4:sw=4:sts=4
99

source code of qtxmlpatterns/tests/auto/xmlpatternssdk/ASTItem.h