1/****************************************************************************
2**
3** Copyright (C) 2015 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the QtScript 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 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 Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QSCRIPTCONTEXTINFO_H
41#define QSCRIPTCONTEXTINFO_H
42
43#include <QtCore/qobjectdefs.h>
44
45#include <QtCore/qlist.h>
46#include <QtCore/qstringlist.h>
47#include <QtCore/qsharedpointer.h>
48#include <QtScript/qtscriptglobal.h>
49
50QT_BEGIN_NAMESPACE
51
52
53class QScriptContext;
54#ifndef QT_NO_DATASTREAM
55class QDataStream;
56#endif
57
58class QScriptContextInfoPrivate;
59class Q_SCRIPT_EXPORT QScriptContextInfo
60{
61public:
62#ifndef QT_NO_DATASTREAM
63 friend Q_SCRIPT_EXPORT QDataStream &operator<<(QDataStream &, const QScriptContextInfo &);
64 friend Q_SCRIPT_EXPORT QDataStream &operator>>(QDataStream &, QScriptContextInfo &);
65#endif
66
67 enum FunctionType {
68 ScriptFunction,
69 QtFunction,
70 QtPropertyFunction,
71 NativeFunction
72 };
73
74 QScriptContextInfo(const QScriptContext *context);
75 QScriptContextInfo(const QScriptContextInfo &other);
76 QScriptContextInfo();
77 ~QScriptContextInfo();
78
79 QScriptContextInfo &operator=(const QScriptContextInfo &other);
80
81 bool isNull() const;
82
83 qint64 scriptId() const;
84 QString fileName() const;
85 int lineNumber() const;
86 int columnNumber() const;
87
88 QString functionName() const;
89 FunctionType functionType() const;
90
91 QStringList functionParameterNames() const;
92
93 int functionStartLineNumber() const;
94 int functionEndLineNumber() const;
95
96 int functionMetaIndex() const;
97
98 bool operator==(const QScriptContextInfo &other) const;
99 bool operator!=(const QScriptContextInfo &other) const;
100
101private:
102 QExplicitlySharedDataPointer<QScriptContextInfoPrivate> d_ptr;
103
104 Q_DECLARE_PRIVATE(QScriptContextInfo)
105};
106
107typedef QList<QScriptContextInfo> QScriptContextInfoList;
108
109#ifndef QT_NO_DATASTREAM
110Q_SCRIPT_EXPORT QDataStream &operator<<(QDataStream &, const QScriptContextInfo &);
111Q_SCRIPT_EXPORT QDataStream &operator>>(QDataStream &, QScriptContextInfo &);
112#endif
113
114QT_END_NAMESPACE
115
116#endif
117

source code of qtscript/src/script/api/qscriptcontextinfo.h