2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-12-03 11:17:25 +01:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-12-03 11:17:25 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-12-03 11:17:25 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:58:39 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-12-03 11:17:25 +01:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-03 11:17:25 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-12-03 11:17:25 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-12-03 11:17:25 +01:00
|
|
|
|
|
|
|
|
#include "languageutils_global.h"
|
|
|
|
|
#include "componentversion.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QString>
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QList>
|
|
|
|
|
#include <QHash>
|
|
|
|
|
#include <QSharedPointer>
|
2010-12-03 11:17:25 +01:00
|
|
|
|
2013-11-13 16:31:04 +01:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QCryptographicHash;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2010-12-03 11:17:25 +01:00
|
|
|
namespace LanguageUtils {
|
|
|
|
|
|
|
|
|
|
class LANGUAGEUTILS_EXPORT FakeMetaEnum {
|
|
|
|
|
QString m_name;
|
|
|
|
|
QStringList m_keys;
|
|
|
|
|
|
|
|
|
|
public:
|
2011-02-08 11:01:37 +01:00
|
|
|
FakeMetaEnum();
|
|
|
|
|
explicit FakeMetaEnum(const QString &name);
|
2010-12-03 11:17:25 +01:00
|
|
|
|
2011-06-21 15:10:57 +02:00
|
|
|
bool isValid() const;
|
|
|
|
|
|
2010-12-03 11:17:25 +01:00
|
|
|
QString name() const;
|
2011-02-08 11:01:37 +01:00
|
|
|
void setName(const QString &name);
|
2010-12-03 11:17:25 +01:00
|
|
|
|
2019-08-29 10:38:36 +02:00
|
|
|
void addKey(const QString &key);
|
2010-12-03 11:17:25 +01:00
|
|
|
QString key(int index) const;
|
|
|
|
|
int keyCount() const;
|
|
|
|
|
QStringList keys() const;
|
2011-07-01 15:09:15 +02:00
|
|
|
bool hasKey(const QString &key) const;
|
2013-11-13 16:31:04 +01:00
|
|
|
void addToHash(QCryptographicHash &hash) const;
|
2014-05-21 16:04:52 +02:00
|
|
|
|
|
|
|
|
QString describe(int baseIndent = 0) const;
|
|
|
|
|
QString toString() const;
|
2010-12-03 11:17:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class LANGUAGEUTILS_EXPORT FakeMetaMethod {
|
|
|
|
|
public:
|
|
|
|
|
enum {
|
|
|
|
|
Signal,
|
|
|
|
|
Slot,
|
|
|
|
|
Method
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
Private,
|
|
|
|
|
Protected,
|
|
|
|
|
Public
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public:
|
2011-02-08 11:01:37 +01:00
|
|
|
FakeMetaMethod();
|
|
|
|
|
explicit FakeMetaMethod(const QString &name, const QString &returnType = QString());
|
2010-12-03 11:17:25 +01:00
|
|
|
|
|
|
|
|
QString methodName() const;
|
2011-02-08 11:01:37 +01:00
|
|
|
void setMethodName(const QString &name);
|
|
|
|
|
|
|
|
|
|
void setReturnType(const QString &type);
|
|
|
|
|
|
2010-12-03 11:17:25 +01:00
|
|
|
QStringList parameterNames() const;
|
|
|
|
|
QStringList parameterTypes() const;
|
|
|
|
|
void addParameter(const QString &name, const QString &type);
|
|
|
|
|
|
|
|
|
|
int methodType() const;
|
|
|
|
|
void setMethodType(int methodType);
|
|
|
|
|
|
|
|
|
|
int access() const;
|
|
|
|
|
|
2011-05-30 09:01:52 +02:00
|
|
|
int revision() const;
|
|
|
|
|
void setRevision(int r);
|
2013-11-13 16:31:04 +01:00
|
|
|
void addToHash(QCryptographicHash &hash) const;
|
2011-05-30 09:01:52 +02:00
|
|
|
|
2014-05-21 16:04:52 +02:00
|
|
|
QString describe(int baseIndent = 0) const;
|
|
|
|
|
QString toString() const;
|
2010-12-03 11:17:25 +01:00
|
|
|
private:
|
|
|
|
|
QString m_name;
|
|
|
|
|
QString m_returnType;
|
|
|
|
|
QStringList m_paramNames;
|
|
|
|
|
QStringList m_paramTypes;
|
|
|
|
|
int m_methodTy;
|
|
|
|
|
int m_methodAccess;
|
2011-05-30 09:01:52 +02:00
|
|
|
int m_revision;
|
2010-12-03 11:17:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class LANGUAGEUTILS_EXPORT FakeMetaProperty {
|
|
|
|
|
QString m_propertyName;
|
|
|
|
|
QString m_type;
|
|
|
|
|
bool m_isList;
|
|
|
|
|
bool m_isWritable;
|
|
|
|
|
bool m_isPointer;
|
2011-05-30 09:01:52 +02:00
|
|
|
int m_revision;
|
2010-12-03 11:17:25 +01:00
|
|
|
|
|
|
|
|
public:
|
2011-05-30 09:01:52 +02:00
|
|
|
FakeMetaProperty(const QString &name, const QString &type, bool isList, bool isWritable, bool isPointer, int revision);
|
2010-12-03 11:17:25 +01:00
|
|
|
|
|
|
|
|
QString name() const;
|
|
|
|
|
QString typeName() const;
|
|
|
|
|
|
|
|
|
|
bool isList() const;
|
|
|
|
|
bool isWritable() const;
|
|
|
|
|
bool isPointer() const;
|
2011-05-30 09:01:52 +02:00
|
|
|
int revision() const;
|
2013-11-13 16:31:04 +01:00
|
|
|
void addToHash(QCryptographicHash &hash) const;
|
2014-05-21 16:04:52 +02:00
|
|
|
|
|
|
|
|
QString describe(int baseIndent = 0) const;
|
|
|
|
|
QString toString() const;
|
2010-12-03 11:17:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class LANGUAGEUTILS_EXPORT FakeMetaObject {
|
|
|
|
|
Q_DISABLE_COPY(FakeMetaObject);
|
|
|
|
|
|
|
|
|
|
public:
|
2011-01-04 17:04:44 +01:00
|
|
|
typedef QSharedPointer<FakeMetaObject> Ptr;
|
|
|
|
|
typedef QSharedPointer<const FakeMetaObject> ConstPtr;
|
|
|
|
|
|
2011-02-10 17:14:59 +01:00
|
|
|
class LANGUAGEUTILS_EXPORT Export {
|
2010-12-03 11:17:25 +01:00
|
|
|
public:
|
2011-09-21 12:42:27 +02:00
|
|
|
Export();
|
|
|
|
|
|
2010-12-03 11:17:25 +01:00
|
|
|
QString package;
|
|
|
|
|
QString type;
|
|
|
|
|
ComponentVersion version;
|
2011-09-21 12:42:27 +02:00
|
|
|
int metaObjectRevision;
|
2011-02-10 14:53:57 +01:00
|
|
|
|
|
|
|
|
bool isValid() const;
|
2013-11-13 16:31:04 +01:00
|
|
|
void addToHash(QCryptographicHash &hash) const;
|
2014-05-21 16:04:52 +02:00
|
|
|
|
|
|
|
|
QString describe(int baseIndent = 0) const;
|
|
|
|
|
QString toString() const;
|
2010-12-03 11:17:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private:
|
2011-02-08 11:01:37 +01:00
|
|
|
QString m_className;
|
2010-12-03 11:17:25 +01:00
|
|
|
QList<Export> m_exports;
|
|
|
|
|
QString m_superName;
|
|
|
|
|
QList<FakeMetaEnum> m_enums;
|
|
|
|
|
QHash<QString, int> m_enumNameToIndex;
|
|
|
|
|
QList<FakeMetaProperty> m_props;
|
|
|
|
|
QHash<QString, int> m_propNameToIdx;
|
|
|
|
|
QList<FakeMetaMethod> m_methods;
|
|
|
|
|
QString m_defaultPropertyName;
|
2011-02-10 14:46:03 +01:00
|
|
|
QString m_attachedTypeName;
|
2021-02-04 17:29:24 +01:00
|
|
|
QString m_extensionTypeName;
|
2013-11-13 16:31:04 +01:00
|
|
|
QByteArray m_fingerprint;
|
2014-02-13 23:53:13 +01:00
|
|
|
bool m_isSingleton;
|
|
|
|
|
bool m_isCreatable;
|
|
|
|
|
bool m_isComposite;
|
2010-12-03 11:17:25 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
FakeMetaObject();
|
|
|
|
|
|
2011-02-08 11:01:37 +01:00
|
|
|
QString className() const;
|
|
|
|
|
void setClassName(const QString &name);
|
|
|
|
|
|
2010-12-03 11:17:25 +01:00
|
|
|
void addExport(const QString &name, const QString &package, ComponentVersion version);
|
2011-09-21 12:42:27 +02:00
|
|
|
void setExportMetaObjectRevision(int exportIndex, int metaObjectRevision);
|
2010-12-03 11:17:25 +01:00
|
|
|
QList<Export> exports() const;
|
2011-02-10 14:53:57 +01:00
|
|
|
Export exportInPackage(const QString &package) const;
|
2010-12-03 11:17:25 +01:00
|
|
|
|
|
|
|
|
void setSuperclassName(const QString &superclass);
|
|
|
|
|
QString superclassName() const;
|
|
|
|
|
|
|
|
|
|
void addEnum(const FakeMetaEnum &fakeEnum);
|
|
|
|
|
int enumeratorCount() const;
|
|
|
|
|
int enumeratorOffset() const;
|
|
|
|
|
FakeMetaEnum enumerator(int index) const;
|
|
|
|
|
int enumeratorIndex(const QString &name) const;
|
|
|
|
|
|
|
|
|
|
void addProperty(const FakeMetaProperty &property);
|
|
|
|
|
int propertyCount() const;
|
|
|
|
|
int propertyOffset() const;
|
|
|
|
|
FakeMetaProperty property(int index) const;
|
|
|
|
|
int propertyIndex(const QString &name) const;
|
|
|
|
|
|
|
|
|
|
void addMethod(const FakeMetaMethod &method);
|
|
|
|
|
int methodCount() const;
|
|
|
|
|
int methodOffset() const;
|
|
|
|
|
FakeMetaMethod method(int index) const;
|
2013-03-29 12:51:48 -07:00
|
|
|
int methodIndex(const QString &name) const; // Note: Returns any method with that name in case of overloads
|
2010-12-03 11:17:25 +01:00
|
|
|
|
|
|
|
|
QString defaultPropertyName() const;
|
2011-02-10 14:46:03 +01:00
|
|
|
void setDefaultPropertyName(const QString &defaultPropertyName);
|
|
|
|
|
|
|
|
|
|
QString attachedTypeName() const;
|
|
|
|
|
void setAttachedTypeName(const QString &name);
|
2021-02-04 17:29:24 +01:00
|
|
|
QString extensionTypeName() const;
|
|
|
|
|
void setExtensionTypeName(const QString &name);
|
2013-11-13 16:31:04 +01:00
|
|
|
QByteArray calculateFingerprint() const;
|
|
|
|
|
void updateFingerprint();
|
|
|
|
|
QByteArray fingerprint() const;
|
2014-02-13 23:53:13 +01:00
|
|
|
|
|
|
|
|
bool isSingleton() const;
|
|
|
|
|
bool isCreatable() const;
|
|
|
|
|
bool isComposite() const;
|
|
|
|
|
void setIsSingleton(bool value);
|
|
|
|
|
void setIsCreatable(bool value);
|
|
|
|
|
void setIsComposite(bool value);
|
2014-05-21 16:04:52 +02:00
|
|
|
|
|
|
|
|
QString describe(bool printDetails = true, int baseIndent = 0) const;
|
|
|
|
|
QString toString() const;
|
2010-12-03 11:17:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace LanguageUtils
|