1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** 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.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef FAKEMETAOBJECT_H
35 #define FAKEMETAOBJECT_H
37 #include "languageutils_global.h"
38 #include "componentversion.h"
40 #include <QtCore/QString>
41 #include <QtCore/QStringList>
42 #include <QtCore/QList>
43 #include <QtCore/QHash>
44 #include <QtCore/QSharedPointer>
46 namespace LanguageUtils {
48 class LANGUAGEUTILS_EXPORT FakeMetaEnum {
54 FakeMetaEnum(const QString &name);
58 void addKey(const QString &key, int value);
59 QString key(int index) const;
61 QStringList keys() const;
64 class LANGUAGEUTILS_EXPORT FakeMetaMethod {
79 FakeMetaMethod(const QString &name, const QString &returnType = QString());
81 QString methodName() const;
82 QStringList parameterNames() const;
83 QStringList parameterTypes() const;
84 void addParameter(const QString &name, const QString &type);
86 int methodType() const;
87 void setMethodType(int methodType);
94 QStringList m_paramNames;
95 QStringList m_paramTypes;
100 class LANGUAGEUTILS_EXPORT FakeMetaProperty {
101 QString m_propertyName;
108 FakeMetaProperty(const QString &name, const QString &type, bool isList, bool isWritable, bool isPointer);
110 QString name() const;
111 QString typeName() const;
114 bool isWritable() const;
115 bool isPointer() const;
118 class LANGUAGEUTILS_EXPORT FakeMetaObject {
119 Q_DISABLE_COPY(FakeMetaObject);
122 typedef QSharedPointer<FakeMetaObject> Ptr;
123 typedef QSharedPointer<const FakeMetaObject> ConstPtr;
129 ComponentVersion version;
130 QString packageNameVersion;
134 QList<Export> m_exports;
137 QList<FakeMetaEnum> m_enums;
138 QHash<QString, int> m_enumNameToIndex;
139 QList<FakeMetaProperty> m_props;
140 QHash<QString, int> m_propNameToIdx;
141 QList<FakeMetaMethod> m_methods;
142 QString m_defaultPropertyName;
147 void addExport(const QString &name, const QString &package, ComponentVersion version);
148 QList<Export> exports() const;
150 void setSuperclassName(const QString &superclass);
151 QString superclassName() const;
152 void setSuperclass(ConstPtr superClass);
153 ConstPtr superClass() const;
155 void addEnum(const FakeMetaEnum &fakeEnum);
156 int enumeratorCount() const;
157 int enumeratorOffset() const;
158 FakeMetaEnum enumerator(int index) const;
159 int enumeratorIndex(const QString &name) const;
161 void addProperty(const FakeMetaProperty &property);
162 int propertyCount() const;
163 int propertyOffset() const;
164 FakeMetaProperty property(int index) const;
165 int propertyIndex(const QString &name) const;
167 void addMethod(const FakeMetaMethod &method);
168 int methodCount() const;
169 int methodOffset() const;
170 FakeMetaMethod method(int index) const;
172 QString defaultPropertyName() const;
173 void setDefaultPropertyName(const QString defaultPropertyName);
176 } // namespace LanguageUtils
178 #endif // FAKEMETAOBJECT_H