OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / libs / qmljs / parser / qmldirparser_p.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 ** GNU Lesser General Public License Usage
10 **
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
14 ** Please review the following information to ensure the GNU Lesser General
15 ** Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 **
22 ** Other Usage
23 **
24 ** Alternatively, this file may be used in accordance with the terms and
25 ** conditions contained in a signed written agreement between you and Nokia.
26 **
27 ** If you have questions regarding the use of this file, please contact
28 ** Nokia at qt-info@nokia.com.
29 **
30 **************************************************************************/
31
32 #ifndef QMLDIRPARSER_P_H
33 #define QMLDIRPARSER_P_H
34
35 //
36 //  W A R N I N G
37 //  -------------
38 //
39 // This file is not part of the Qt API.  It exists purely as an
40 // implementation detail.  This header file may change from version to
41 // version without notice, or even be removed.
42 //
43 // We mean it.
44 //
45
46 #include <QtCore/QUrl>
47 #include <QtCore/QHash>
48
49 #include "qmljsglobal_p.h"
50
51 QT_BEGIN_NAMESPACE
52
53 class QmlError;
54 class QML_PARSER_EXPORT QmlDirParser
55 {
56     Q_DISABLE_COPY(QmlDirParser)
57
58 public:
59     QmlDirParser();
60     ~QmlDirParser();
61
62     QUrl url() const;
63     void setUrl(const QUrl &url);
64
65     QString source() const;
66     void setSource(const QString &source);
67
68     bool isParsed() const;
69     bool parse();
70
71     bool hasError() const;
72     QList<QmlError> errors() const;
73
74     struct Plugin
75     {
76         Plugin() {}
77
78         Plugin(const QString &name, const QString &path)
79             : name(name), path(path) {}
80
81         QString name;
82         QString path;
83     };
84
85     struct Component
86     {
87         Component()
88             : majorVersion(0), minorVersion(0), internal(false) {}
89
90         Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion)
91             : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion),
92             internal(false) {}
93
94         QString typeName;
95         QString fileName;
96         int majorVersion;
97         int minorVersion;
98         bool internal;
99     };
100
101     QList<Component> components() const;
102     QList<Plugin> plugins() const;
103
104 private:
105     void reportError(int line, int column, const QString &message);
106
107 private:
108     QList<QmlError> _errors;
109     QUrl _url;
110     QString _source;
111     QList<Component> _components;
112     QList<Plugin> _plugins;
113     unsigned _isParsed: 1;
114 };
115
116 typedef QList<QmlDirParser::Component> QmlDirComponents;
117
118
119 QT_END_NAMESPACE
120
121 #endif // QMLDIRPARSER_P_H