Fixed crazy runtime error due to compilation of unneeded private Qt cpp files.
This commit is contained in:
parent
fa0299268c
commit
4e92cd61a0
|
@ -2,4 +2,5 @@
|
|||
build
|
||||
*.pro.*
|
||||
*.o
|
||||
.directory
|
||||
.directory
|
||||
nimcache
|
|
@ -5,6 +5,7 @@
|
|||
#include <QtQml/QQmlContext>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtQml/QQmlApplicationEngine>
|
||||
|
||||
#include "DynamicQObject.h"
|
||||
|
||||
|
@ -33,6 +34,23 @@ void dos_guiapplication_exec()
|
|||
qApp->exec();
|
||||
}
|
||||
|
||||
void dos_qqmlapplicationengine_create(void **vptr)
|
||||
{
|
||||
*vptr = new QQmlApplicationEngine();
|
||||
}
|
||||
|
||||
void dos_qqmlapplicationengine_load(void *vptr, const char *filename)
|
||||
{
|
||||
QQmlApplicationEngine* engine = reinterpret_cast<QQmlApplicationEngine*>(vptr);
|
||||
engine->load(QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + QDir::separator() + QString(filename)));
|
||||
}
|
||||
|
||||
void dos_qqmlapplicationengine_delete(void* vptr)
|
||||
{
|
||||
QQmlApplicationEngine* engine = reinterpret_cast<QQmlApplicationEngine*>(vptr);
|
||||
delete engine;
|
||||
}
|
||||
|
||||
void dos_quickview_create(void** vptr)
|
||||
{
|
||||
*vptr = new QQuickView();
|
||||
|
@ -177,6 +195,7 @@ void dos_qvariant_setString(void* vptr, const char* value)
|
|||
*variant = value;
|
||||
}
|
||||
|
||||
|
||||
void dos_qobject_create(void** vptr, void* dObjectPointer, DObjectCallback dObjectCallback)
|
||||
{
|
||||
auto dynamicQObject = new DynamicQObject();
|
||||
|
|
|
@ -14,6 +14,10 @@ void dos_guiapplication_create();
|
|||
void dos_guiapplication_exec();
|
||||
void dos_guiapplication_delete();
|
||||
|
||||
void dos_qqmlapplicationengine_create(void** vptr);
|
||||
void dos_qqmlapplicationengine_load(void* vptr, const char* filename);
|
||||
void dos_qqmlapplicationengine_delete(void* vptr);
|
||||
|
||||
void dos_quickview_create(void** vptr);
|
||||
void dos_quickview_show(void* vptr);
|
||||
void dos_quickview_source(void* vptr, CharPtr& result, int& length);
|
||||
|
@ -41,6 +45,7 @@ void dos_qvariant_setString(void* vptr, const char* value);
|
|||
void dos_qvariant_isnull(void *vptr, bool& isNull);
|
||||
void dos_qvariant_delete(void *vptr);
|
||||
|
||||
|
||||
void dos_qobject_create(void **vptr, void *dObjectPointer, DObjectCallback dObjectCallback);
|
||||
void dos_qobject_slot_create(void* vptr, const char* name, int parametersCount, int* parametersMetaTypes, int* slotIndex);
|
||||
void dos_qobject_signal_create(void* vptr, const char* name, int parametersCount, int* parametersMetaTypes, int* signalIndex);
|
||||
|
|
|
@ -8,7 +8,7 @@ QT += quick
|
|||
|
||||
CONFIG += c++11
|
||||
|
||||
QMAKE_CXXFLAGS += "-O1 -fpic"
|
||||
QMAKE_CXXFLAGS += "-fpic"
|
||||
|
||||
TARGET = DOtherSide
|
||||
TEMPLATE = lib
|
||||
|
|
|
@ -221,6 +221,3 @@ int DynamicQObject::qt_metacall(QMetaObject::Call callType, int index, void** a
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
class QMetaObject;
|
||||
|
||||
#include <QScopedPointer>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
#include "DynamicSignal.h"
|
||||
#include "DynamicSlot.h"
|
||||
|
||||
|
||||
class DynamicQObject : public QObject
|
||||
{
|
||||
typedef void (*Callback)(void*, void*, int, void **);
|
||||
|
||||
public:
|
||||
DynamicQObject(QObject* parent = 0);
|
||||
virtual ~DynamicQObject();
|
||||
|
||||
virtual ~DynamicQObject();
|
||||
|
||||
void setDObjectCallback(Callback callback) { m_dObjectCallback = callback; }
|
||||
void setDObjectPointer(void* dObjectPointer) { m_dObjectPointer = dObjectPointer; }
|
||||
|
|
|
@ -11,22 +11,16 @@ INCLUDEPATH += private
|
|||
CONFIG += c++11
|
||||
CONFIG += staticlib
|
||||
|
||||
QMAKE_CXXFLAGS += "-fpic"
|
||||
|
||||
# Input
|
||||
HEADERS += DynamicQObject.h \
|
||||
private/qmetaobjectbuilder_p.h \
|
||||
private/qmetaobject_p.h \
|
||||
private/qobject_p.h \
|
||||
private/qmetaobject_moc_p.h \
|
||||
private/qmetaobject.h \
|
||||
private/qmetatype_p.h \
|
||||
private/qmetatype.h \
|
||||
private/qmetatypeswitcher_p.h \
|
||||
DynamicSignal.h \
|
||||
DynamicSlot.h
|
||||
SOURCES += DynamicQObject.cpp \
|
||||
private/qmetaobjectbuilder.cpp \
|
||||
private/qmetaobject.cpp \
|
||||
private/qmetatype.cpp \
|
||||
DynamicSignal.cpp \
|
||||
DynamicSlot.cpp
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ DynamicSignal& DynamicSignal::operator=(const DynamicSignal& signal)
|
|||
|
||||
DynamicSignal::~DynamicSignal()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool DynamicSignal::isValid() const
|
||||
|
@ -89,4 +88,3 @@ void DynamicSignal::_initSignature()
|
|||
|
||||
d->signature = signature.arg(d->name, arguments).toUtf8();
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,277 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** 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
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QMETAOBJECT_H
|
||||
#define QMETAOBJECT_H
|
||||
|
||||
#include <QtCore/qobjectdefs.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
template <typename T> class QList;
|
||||
|
||||
#define Q_METAMETHOD_INVOKE_MAX_ARGS 10
|
||||
|
||||
class Q_CORE_EXPORT QMetaMethod
|
||||
{
|
||||
public:
|
||||
inline QMetaMethod() : mobj(0),handle(0) {}
|
||||
|
||||
QByteArray methodSignature() const;
|
||||
QByteArray name() const;
|
||||
const char *typeName() const;
|
||||
int returnType() const;
|
||||
int parameterCount() const;
|
||||
int parameterType(int index) const;
|
||||
void getParameterTypes(int *types) const;
|
||||
QList<QByteArray> parameterTypes() const;
|
||||
QList<QByteArray> parameterNames() const;
|
||||
const char *tag() const;
|
||||
enum Access { Private, Protected, Public };
|
||||
Access access() const;
|
||||
enum MethodType { Method, Signal, Slot, Constructor };
|
||||
MethodType methodType() const;
|
||||
enum Attributes { Compatibility = 0x1, Cloned = 0x2, Scriptable = 0x4 };
|
||||
int attributes() const;
|
||||
int methodIndex() const;
|
||||
int revision() const;
|
||||
|
||||
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
|
||||
|
||||
bool invoke(QObject *object,
|
||||
Qt::ConnectionType connectionType,
|
||||
QGenericReturnArgument returnValue,
|
||||
QGenericArgument val0 = QGenericArgument(0),
|
||||
QGenericArgument val1 = QGenericArgument(),
|
||||
QGenericArgument val2 = QGenericArgument(),
|
||||
QGenericArgument val3 = QGenericArgument(),
|
||||
QGenericArgument val4 = QGenericArgument(),
|
||||
QGenericArgument val5 = QGenericArgument(),
|
||||
QGenericArgument val6 = QGenericArgument(),
|
||||
QGenericArgument val7 = QGenericArgument(),
|
||||
QGenericArgument val8 = QGenericArgument(),
|
||||
QGenericArgument val9 = QGenericArgument()) const;
|
||||
inline bool invoke(QObject *object,
|
||||
QGenericReturnArgument returnValue,
|
||||
QGenericArgument val0 = QGenericArgument(0),
|
||||
QGenericArgument val1 = QGenericArgument(),
|
||||
QGenericArgument val2 = QGenericArgument(),
|
||||
QGenericArgument val3 = QGenericArgument(),
|
||||
QGenericArgument val4 = QGenericArgument(),
|
||||
QGenericArgument val5 = QGenericArgument(),
|
||||
QGenericArgument val6 = QGenericArgument(),
|
||||
QGenericArgument val7 = QGenericArgument(),
|
||||
QGenericArgument val8 = QGenericArgument(),
|
||||
QGenericArgument val9 = QGenericArgument()) const
|
||||
{
|
||||
return invoke(object, Qt::AutoConnection, returnValue,
|
||||
val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
|
||||
}
|
||||
inline bool invoke(QObject *object,
|
||||
Qt::ConnectionType connectionType,
|
||||
QGenericArgument val0 = QGenericArgument(0),
|
||||
QGenericArgument val1 = QGenericArgument(),
|
||||
QGenericArgument val2 = QGenericArgument(),
|
||||
QGenericArgument val3 = QGenericArgument(),
|
||||
QGenericArgument val4 = QGenericArgument(),
|
||||
QGenericArgument val5 = QGenericArgument(),
|
||||
QGenericArgument val6 = QGenericArgument(),
|
||||
QGenericArgument val7 = QGenericArgument(),
|
||||
QGenericArgument val8 = QGenericArgument(),
|
||||
QGenericArgument val9 = QGenericArgument()) const
|
||||
{
|
||||
return invoke(object, connectionType, QGenericReturnArgument(),
|
||||
val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
|
||||
}
|
||||
inline bool invoke(QObject *object,
|
||||
QGenericArgument val0 = QGenericArgument(0),
|
||||
QGenericArgument val1 = QGenericArgument(),
|
||||
QGenericArgument val2 = QGenericArgument(),
|
||||
QGenericArgument val3 = QGenericArgument(),
|
||||
QGenericArgument val4 = QGenericArgument(),
|
||||
QGenericArgument val5 = QGenericArgument(),
|
||||
QGenericArgument val6 = QGenericArgument(),
|
||||
QGenericArgument val7 = QGenericArgument(),
|
||||
QGenericArgument val8 = QGenericArgument(),
|
||||
QGenericArgument val9 = QGenericArgument()) const
|
||||
{
|
||||
return invoke(object, Qt::AutoConnection, QGenericReturnArgument(),
|
||||
val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
|
||||
}
|
||||
|
||||
inline bool isValid() const { return mobj != 0; }
|
||||
|
||||
#ifdef Q_QDOC
|
||||
static QMetaMethod fromSignal(PointerToMemberFunction signal);
|
||||
#else
|
||||
template <typename Func>
|
||||
static inline QMetaMethod fromSignal(Func signal)
|
||||
{
|
||||
typedef QtPrivate::FunctionPointer<Func> SignalType;
|
||||
Q_STATIC_ASSERT_X(QtPrivate::HasQ_OBJECT_Macro<typename SignalType::Object>::Value,
|
||||
"No Q_OBJECT in the class with the signal");
|
||||
return fromSignalImpl(&SignalType::Object::staticMetaObject,
|
||||
reinterpret_cast<void **>(&signal));
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
#if QT_DEPRECATED_SINCE(5,0)
|
||||
// signature() has been renamed to methodSignature() in Qt 5.
|
||||
// Warning, that function returns a QByteArray; check the life time if
|
||||
// you convert to char*.
|
||||
char *signature(struct renamedInQt5_warning_checkTheLifeTime * = 0) Q_DECL_EQ_DELETE;
|
||||
#endif
|
||||
static QMetaMethod fromSignalImpl(const QMetaObject *, void **);
|
||||
|
||||
const QMetaObject *mobj;
|
||||
uint handle;
|
||||
friend class QMetaMethodPrivate;
|
||||
friend struct QMetaObject;
|
||||
friend struct QMetaObjectPrivate;
|
||||
friend class QObject;
|
||||
friend bool operator==(const QMetaMethod &m1, const QMetaMethod &m2);
|
||||
friend bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2);
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QMetaMethod, Q_MOVABLE_TYPE);
|
||||
|
||||
inline bool operator==(const QMetaMethod &m1, const QMetaMethod &m2)
|
||||
{ return m1.mobj == m2.mobj && m1.handle == m2.handle; }
|
||||
inline bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2)
|
||||
{ return !(m1 == m2); }
|
||||
|
||||
class Q_CORE_EXPORT QMetaEnum
|
||||
{
|
||||
public:
|
||||
inline QMetaEnum() : mobj(0),handle(0) {}
|
||||
|
||||
const char *name() const;
|
||||
bool isFlag() const;
|
||||
|
||||
int keyCount() const;
|
||||
const char *key(int index) const;
|
||||
int value(int index) const;
|
||||
|
||||
const char *scope() const;
|
||||
|
||||
int keyToValue(const char *key, bool *ok = 0) const;
|
||||
const char* valueToKey(int value) const;
|
||||
int keysToValue(const char * keys, bool *ok = 0) const;
|
||||
QByteArray valueToKeys(int value) const;
|
||||
|
||||
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
|
||||
|
||||
inline bool isValid() const { return name() != 0; }
|
||||
private:
|
||||
const QMetaObject *mobj;
|
||||
uint handle;
|
||||
friend struct QMetaObject;
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QMetaEnum, Q_MOVABLE_TYPE);
|
||||
|
||||
class Q_CORE_EXPORT QMetaProperty
|
||||
{
|
||||
public:
|
||||
QMetaProperty();
|
||||
|
||||
const char *name() const;
|
||||
const char *typeName() const;
|
||||
QVariant::Type type() const;
|
||||
int userType() const;
|
||||
int propertyIndex() const;
|
||||
|
||||
bool isReadable() const;
|
||||
bool isWritable() const;
|
||||
bool isResettable() const;
|
||||
bool isDesignable(const QObject *obj = 0) const;
|
||||
bool isScriptable(const QObject *obj = 0) const;
|
||||
bool isStored(const QObject *obj = 0) const;
|
||||
bool isEditable(const QObject *obj = 0) const;
|
||||
bool isUser(const QObject *obj = 0) const;
|
||||
bool isConstant() const;
|
||||
bool isFinal() const;
|
||||
|
||||
bool isFlagType() const;
|
||||
bool isEnumType() const;
|
||||
QMetaEnum enumerator() const;
|
||||
|
||||
bool hasNotifySignal() const;
|
||||
QMetaMethod notifySignal() const;
|
||||
int notifySignalIndex() const;
|
||||
|
||||
int revision() const;
|
||||
|
||||
QVariant read(const QObject *obj) const;
|
||||
bool write(QObject *obj, const QVariant &value) const;
|
||||
bool reset(QObject *obj) const;
|
||||
|
||||
bool hasStdCppSet() const;
|
||||
inline bool isValid() const { return isReadable(); }
|
||||
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
|
||||
|
||||
private:
|
||||
const QMetaObject *mobj;
|
||||
uint handle;
|
||||
int idx;
|
||||
QMetaEnum menum;
|
||||
friend struct QMetaObject;
|
||||
friend struct QMetaObjectPrivate;
|
||||
};
|
||||
|
||||
class Q_CORE_EXPORT QMetaClassInfo
|
||||
{
|
||||
public:
|
||||
inline QMetaClassInfo() : mobj(0),handle(0) {}
|
||||
const char *name() const;
|
||||
const char *value() const;
|
||||
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
|
||||
private:
|
||||
const QMetaObject *mobj;
|
||||
uint handle;
|
||||
friend struct QMetaObject;
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QMetaClassInfo, Q_MOVABLE_TYPE);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMETAOBJECT_H
|
|
@ -1,208 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** 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
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(QMETAOBJECT_P_H) && !defined(UTILS_H)
|
||||
# error "Include qmetaobject_p.h (or moc's utils.h) before including this file."
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// This function is shared with moc.cpp. This file should be included where needed.
|
||||
static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixScope = false, bool adjustConst = true)
|
||||
{
|
||||
int len = e - t;
|
||||
/*
|
||||
Convert 'char const *' into 'const char *'. Start at index 1,
|
||||
not 0, because 'const char *' is already OK.
|
||||
*/
|
||||
QByteArray constbuf;
|
||||
for (int i = 1; i < len; i++) {
|
||||
if ( t[i] == 'c'
|
||||
&& strncmp(t + i + 1, "onst", 4) == 0
|
||||
&& (i + 5 >= len || !is_ident_char(t[i + 5]))
|
||||
&& !is_ident_char(t[i-1])
|
||||
) {
|
||||
constbuf = QByteArray(t, len);
|
||||
if (is_space(t[i-1]))
|
||||
constbuf.remove(i-1, 6);
|
||||
else
|
||||
constbuf.remove(i, 5);
|
||||
constbuf.prepend("const ");
|
||||
t = constbuf.data();
|
||||
e = constbuf.data() + constbuf.length();
|
||||
break;
|
||||
}
|
||||
/*
|
||||
We mustn't convert 'char * const *' into 'const char **'
|
||||
and we must beware of 'Bar<const Bla>'.
|
||||
*/
|
||||
if (t[i] == '&' || t[i] == '*' ||t[i] == '<')
|
||||
break;
|
||||
}
|
||||
if (adjustConst && e > t + 6 && strncmp("const ", t, 6) == 0) {
|
||||
if (*(e-1) == '&') { // treat const reference as value
|
||||
t += 6;
|
||||
--e;
|
||||
} else if (is_ident_char(*(e-1)) || *(e-1) == '>') { // treat const value as value
|
||||
t += 6;
|
||||
}
|
||||
}
|
||||
QByteArray result;
|
||||
result.reserve(len);
|
||||
|
||||
#if 1
|
||||
// consume initial 'const '
|
||||
if (strncmp("const ", t, 6) == 0) {
|
||||
t+= 6;
|
||||
result += "const ";
|
||||
}
|
||||
#endif
|
||||
|
||||
// some type substitutions for 'unsigned x'
|
||||
if (strncmp("unsigned", t, 8) == 0) {
|
||||
// make sure "unsigned" is an isolated word before making substitutions
|
||||
if (!t[8] || !is_ident_char(t[8])) {
|
||||
if (strncmp(" int", t+8, 4) == 0) {
|
||||
t += 8+4;
|
||||
result += "uint";
|
||||
} else if (strncmp(" long", t+8, 5) == 0) {
|
||||
if ((strlen(t + 8 + 5) < 4 || strncmp(t + 8 + 5, " int", 4) != 0) // preserve '[unsigned] long int'
|
||||
&& (strlen(t + 8 + 5) < 5 || strncmp(t + 8 + 5, " long", 5) != 0) // preserve '[unsigned] long long'
|
||||
) {
|
||||
t += 8+5;
|
||||
result += "ulong";
|
||||
}
|
||||
} else if (strncmp(" short", t+8, 6) != 0 // preserve unsigned short
|
||||
&& strncmp(" char", t+8, 5) != 0) { // preserve unsigned char
|
||||
// treat rest (unsigned) as uint
|
||||
t += 8;
|
||||
result += "uint";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// discard 'struct', 'class', and 'enum'; they are optional
|
||||
// and we don't want them in the normalized signature
|
||||
struct {
|
||||
const char *keyword;
|
||||
int len;
|
||||
} optional[] = {
|
||||
{ "struct ", 7 },
|
||||
{ "class ", 6 },
|
||||
{ "enum ", 5 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
int i = 0;
|
||||
do {
|
||||
if (strncmp(optional[i].keyword, t, optional[i].len) == 0) {
|
||||
t += optional[i].len;
|
||||
break;
|
||||
}
|
||||
} while (optional[++i].keyword != 0);
|
||||
}
|
||||
|
||||
bool star = false;
|
||||
while (t != e) {
|
||||
char c = *t++;
|
||||
if (fixScope && c == ':' && *t == ':' ) {
|
||||
++t;
|
||||
c = *t++;
|
||||
int i = result.size() - 1;
|
||||
while (i >= 0 && is_ident_char(result.at(i)))
|
||||
--i;
|
||||
result.resize(i + 1);
|
||||
}
|
||||
star = star || c == '*';
|
||||
result += c;
|
||||
if (c == '<') {
|
||||
//template recursion
|
||||
const char* tt = t;
|
||||
int templdepth = 1;
|
||||
int scopeDepth = 0;
|
||||
while (t != e) {
|
||||
c = *t++;
|
||||
if (c == '{' || c == '(' || c == '[')
|
||||
++scopeDepth;
|
||||
if (c == '}' || c == ')' || c == ']')
|
||||
--scopeDepth;
|
||||
if (scopeDepth == 0) {
|
||||
if (c == '<')
|
||||
++templdepth;
|
||||
if (c == '>')
|
||||
--templdepth;
|
||||
if (templdepth == 0 || (templdepth == 1 && c == ',')) {
|
||||
result += normalizeTypeInternal(tt, t-1, fixScope, false);
|
||||
result += c;
|
||||
if (templdepth == 0) {
|
||||
if (*t == '>')
|
||||
result += ' '; // avoid >>
|
||||
break;
|
||||
}
|
||||
tt = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cv qualifers can appear after the type as well
|
||||
if (!is_ident_char(c) && t != e && (e - t >= 5 && strncmp("const", t, 5) == 0)
|
||||
&& (e - t == 5 || !is_ident_char(t[5]))) {
|
||||
t += 5;
|
||||
while (t != e && is_space(*t))
|
||||
++t;
|
||||
if (adjustConst && t != e && *t == '&') {
|
||||
// treat const ref as value
|
||||
++t;
|
||||
} else if (adjustConst && !star) {
|
||||
// treat const as value
|
||||
} else if (!star) {
|
||||
// move const to the front (but not if const comes after a *)
|
||||
result.prepend("const ");
|
||||
} else {
|
||||
// keep const after a *
|
||||
result += "const";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,255 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** 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
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QMETATYPE_P_H
|
||||
#define QMETATYPE_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "qmetatype.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QModulesPrivate {
|
||||
enum Names { Core, Gui, Widgets, Unknown, ModulesCount /* ModulesCount has to be at the end */ };
|
||||
|
||||
static inline int moduleForType(const uint typeId)
|
||||
{
|
||||
if (typeId <= QMetaType::LastCoreType)
|
||||
return Core;
|
||||
if (typeId >= QMetaType::FirstGuiType && typeId <= QMetaType::LastGuiType)
|
||||
return Gui;
|
||||
if (typeId >= QMetaType::FirstWidgetsType && typeId <= QMetaType::LastWidgetsType)
|
||||
return Widgets;
|
||||
return Unknown;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
class QTypeModuleInfo
|
||||
{
|
||||
public:
|
||||
enum Module {
|
||||
IsCore = !QTypeInfo<T>::isComplex, // Primitive types are in Core
|
||||
IsWidget = false,
|
||||
IsGui = false,
|
||||
IsUnknown = !IsCore
|
||||
};
|
||||
};
|
||||
|
||||
#define QT_ASSIGN_TYPE_TO_MODULE(TYPE, MODULE) \
|
||||
template<> \
|
||||
class QTypeModuleInfo<TYPE > \
|
||||
{ \
|
||||
public: \
|
||||
enum Module { \
|
||||
IsCore = (((MODULE) == (QModulesPrivate::Core))), \
|
||||
IsWidget = (((MODULE) == (QModulesPrivate::Widgets))), \
|
||||
IsGui = (((MODULE) == (QModulesPrivate::Gui))), \
|
||||
IsUnknown = !(IsCore || IsWidget || IsGui) \
|
||||
}; \
|
||||
static inline int module() { return MODULE; } \
|
||||
Q_STATIC_ASSERT((IsUnknown && !(IsCore || IsWidget || IsGui)) \
|
||||
|| (IsCore && !(IsUnknown || IsWidget || IsGui)) \
|
||||
|| (IsWidget && !(IsUnknown || IsCore || IsGui)) \
|
||||
|| (IsGui && !(IsUnknown || IsCore || IsWidget))); \
|
||||
};
|
||||
|
||||
|
||||
#define QT_DECLARE_CORE_MODULE_TYPES_ITER(TypeName, TypeId, Name) \
|
||||
QT_ASSIGN_TYPE_TO_MODULE(Name, QModulesPrivate::Core);
|
||||
#define QT_DECLARE_GUI_MODULE_TYPES_ITER(TypeName, TypeId, Name) \
|
||||
QT_ASSIGN_TYPE_TO_MODULE(Name, QModulesPrivate::Gui);
|
||||
#define QT_DECLARE_WIDGETS_MODULE_TYPES_ITER(TypeName, TypeId, Name) \
|
||||
QT_ASSIGN_TYPE_TO_MODULE(Name, QModulesPrivate::Widgets);
|
||||
|
||||
QT_FOR_EACH_STATIC_CORE_CLASS(QT_DECLARE_CORE_MODULE_TYPES_ITER)
|
||||
QT_FOR_EACH_STATIC_CORE_TEMPLATE(QT_DECLARE_CORE_MODULE_TYPES_ITER)
|
||||
QT_FOR_EACH_STATIC_GUI_CLASS(QT_DECLARE_GUI_MODULE_TYPES_ITER)
|
||||
QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_DECLARE_WIDGETS_MODULE_TYPES_ITER)
|
||||
} // namespace QModulesPrivate
|
||||
|
||||
#undef QT_DECLARE_CORE_MODULE_TYPES_ITER
|
||||
#undef QT_DECLARE_GUI_MODULE_TYPES_ITER
|
||||
#undef QT_DECLARE_WIDGETS_MODULE_TYPES_ITER
|
||||
|
||||
class QMetaTypeInterface
|
||||
{
|
||||
public:
|
||||
QMetaType::Creator creator;
|
||||
QMetaType::Deleter deleter;
|
||||
QMetaType::SaveOperator saveOp;
|
||||
QMetaType::LoadOperator loadOp;
|
||||
QMetaType::Constructor constructor;
|
||||
QMetaType::Destructor destructor;
|
||||
int size;
|
||||
quint32 flags; // same as QMetaType::TypeFlags
|
||||
const QMetaObject *metaObject;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
# define QT_METATYPE_INTERFACE_INIT_DATASTREAM_IMPL(Type) \
|
||||
/*saveOp*/(QtMetaTypePrivate::QMetaTypeFunctionHelper<Type, QtMetaTypePrivate::TypeDefinition<Type>::IsAvailable>::Save), \
|
||||
/*loadOp*/(QtMetaTypePrivate::QMetaTypeFunctionHelper<Type, QtMetaTypePrivate::TypeDefinition<Type>::IsAvailable>::Load),
|
||||
# define QT_METATYPE_INTERFACE_INIT_EMPTY_DATASTREAM_IMPL(Type) \
|
||||
/*saveOp*/ 0, \
|
||||
/*loadOp*/ 0,
|
||||
#else
|
||||
# define QT_METATYPE_INTERFACE_INIT_EMPTY_DATASTREAM_IMPL(Type) \
|
||||
/*saveOp*/ 0, \
|
||||
/*loadOp*/ 0,
|
||||
# define QT_METATYPE_INTERFACE_INIT_DATASTREAM_IMPL(Type) \
|
||||
QT_METATYPE_INTERFACE_INIT_EMPTY_DATASTREAM_IMPL(Type)
|
||||
#endif
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
#define METAOBJECT_DELEGATE(Type) (QtPrivate::MetaObjectForType<Type>::value())
|
||||
#else
|
||||
#define METAOBJECT_DELEGATE(Type) 0
|
||||
#endif
|
||||
|
||||
#define QT_METATYPE_INTERFACE_INIT_IMPL(Type, DATASTREAM_DELEGATE) \
|
||||
{ \
|
||||
/*creator*/(QtMetaTypePrivate::QMetaTypeFunctionHelper<Type, QtMetaTypePrivate::TypeDefinition<Type>::IsAvailable>::Create), \
|
||||
/*deleter*/(QtMetaTypePrivate::QMetaTypeFunctionHelper<Type, QtMetaTypePrivate::TypeDefinition<Type>::IsAvailable>::Delete), \
|
||||
DATASTREAM_DELEGATE(Type) \
|
||||
/*constructor*/(QtMetaTypePrivate::QMetaTypeFunctionHelper<Type, QtMetaTypePrivate::TypeDefinition<Type>::IsAvailable>::Construct), \
|
||||
/*destructor*/(QtMetaTypePrivate::QMetaTypeFunctionHelper<Type, QtMetaTypePrivate::TypeDefinition<Type>::IsAvailable>::Destruct), \
|
||||
/*size*/(QTypeInfo<Type>::sizeOf), \
|
||||
/*flags*/QtPrivate::QMetaTypeTypeFlags<Type>::Flags, \
|
||||
/*metaObject*/METAOBJECT_DELEGATE(Type) \
|
||||
}
|
||||
|
||||
|
||||
/* These QT_METATYPE_INTERFACE_INIT* macros are used to initialize QMetaTypeInterface instance.
|
||||
|
||||
- QT_METATYPE_INTERFACE_INIT(Type) -> It takes Type argument and creates all necessary wrapper functions for the Type,
|
||||
it detects if QT_NO_DATASTREAM was defined. Probably it is the macro that you want to use.
|
||||
|
||||
- QT_METATYPE_INTERFACE_INIT_EMPTY() -> It initializes an empty QMetaTypeInterface instance.
|
||||
|
||||
- QT_METATYPE_INTERFACE_INIT_NO_DATASTREAM(Type) -> Temporary workaround for missing auto-detection of data stream
|
||||
operators. It creates same instance as QT_METATYPE_INTERFACE_INIT(Type) but with null stream operators callbacks.
|
||||
*/
|
||||
#define QT_METATYPE_INTERFACE_INIT(Type) QT_METATYPE_INTERFACE_INIT_IMPL(Type, QT_METATYPE_INTERFACE_INIT_DATASTREAM_IMPL)
|
||||
#define QT_METATYPE_INTERFACE_INIT_NO_DATASTREAM(Type) QT_METATYPE_INTERFACE_INIT_IMPL(Type, QT_METATYPE_INTERFACE_INIT_EMPTY_DATASTREAM_IMPL)
|
||||
#define QT_METATYPE_INTERFACE_INIT_EMPTY() \
|
||||
{ \
|
||||
/*creator*/ 0, \
|
||||
/*deleter*/ 0, \
|
||||
QT_METATYPE_INTERFACE_INIT_EMPTY_DATASTREAM_IMPL(void) \
|
||||
/*constructor*/ 0, \
|
||||
/*destructor*/ 0, \
|
||||
/*size*/ 0, \
|
||||
/*flags*/ 0, \
|
||||
/*metaObject*/ 0 \
|
||||
}
|
||||
|
||||
namespace QtMetaTypePrivate {
|
||||
template<typename T>
|
||||
struct TypeDefinition {
|
||||
static const bool IsAvailable = true;
|
||||
};
|
||||
|
||||
// Ignore these types, as incomplete
|
||||
#ifdef QT_BOOTSTRAPPED
|
||||
template<> struct TypeDefinition<QBitArray> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QEasingCurve> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QJsonArray> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QJsonDocument> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QJsonObject> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QJsonValue> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QModelIndex> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QUrl> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#ifdef QT_NO_GEOM_VARIANT
|
||||
template<> struct TypeDefinition<QRect> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QRectF> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QSize> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QSizeF> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QLine> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QLineF> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QPoint> { static const bool IsAvailable = false; };
|
||||
template<> struct TypeDefinition<QPointF> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#ifdef QT_NO_REGEXP
|
||||
template<> struct TypeDefinition<QRegExp> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#if defined(QT_BOOTSTRAPPED) || defined(QT_NO_REGULAREXPRESSION)
|
||||
template<> struct TypeDefinition<QRegularExpression> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#ifdef QT_NO_SHORTCUT
|
||||
template<> struct TypeDefinition<QKeySequence> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#ifdef QT_NO_CURSOR
|
||||
template<> struct TypeDefinition<QCursor> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#ifdef QT_NO_MATRIX4X4
|
||||
template<> struct TypeDefinition<QMatrix4x4> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#ifdef QT_NO_VECTOR2D
|
||||
template<> struct TypeDefinition<QVector2D> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#ifdef QT_NO_VECTOR3D
|
||||
template<> struct TypeDefinition<QVector3D> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#ifdef QT_NO_VECTOR4D
|
||||
template<> struct TypeDefinition<QVector4D> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#ifdef QT_NO_QUATERNION
|
||||
template<> struct TypeDefinition<QQuaternion> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
#ifdef QT_NO_ICON
|
||||
template<> struct TypeDefinition<QIcon> { static const bool IsAvailable = false; };
|
||||
#endif
|
||||
} //namespace QtMetaTypePrivate
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMETATYPE_P_H
|
|
@ -1,91 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** 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
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QMETATYPESWITCHER_P_H
|
||||
#define QMETATYPESWITCHER_P_H
|
||||
|
||||
#include "qmetatype.h"
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QMetaTypeSwitcher {
|
||||
public:
|
||||
class NotBuiltinType; // type is not a built-in type, but it may be a custom type or an unknown type
|
||||
class UnknownType; // type not known to QMetaType system
|
||||
template<class ReturnType, class DelegateObject>
|
||||
static ReturnType switcher(DelegateObject &logic, int type, const void *data);
|
||||
};
|
||||
|
||||
|
||||
#define QT_METATYPE_SWICHER_CASE(TypeName, TypeId, Name)\
|
||||
case QMetaType::TypeName: return logic.delegate(static_cast<Name const *>(data));
|
||||
|
||||
template<class ReturnType, class DelegateObject>
|
||||
ReturnType QMetaTypeSwitcher::switcher(DelegateObject &logic, int type, const void *data)
|
||||
{
|
||||
switch (QMetaType::Type(type)) {
|
||||
QT_FOR_EACH_STATIC_TYPE(QT_METATYPE_SWICHER_CASE)
|
||||
|
||||
case QMetaType::UnknownType:
|
||||
return logic.delegate(static_cast<UnknownType const *>(data));
|
||||
default:
|
||||
if (type < QMetaType::User)
|
||||
return logic.delegate(static_cast<UnknownType const *>(data));
|
||||
return logic.delegate(static_cast<NotBuiltinType const *>(data));
|
||||
}
|
||||
}
|
||||
|
||||
#undef QT_METATYPE_SWICHER_CASE
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMETATYPESWITCHER_P_H
|
Loading…
Reference in New Issue