Qt 4.8
qdeclarativemetatype_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDeclarative 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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 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.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QDECLARATIVEMETATYPE_P_H
43 #define QDECLARATIVEMETATYPE_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "qdeclarative.h"
57 
58 #include <QtCore/qglobal.h>
59 #include <QtCore/qvariant.h>
60 #include <QtCore/qbitarray.h>
61 #include <private/qdeclarativeglobal_p.h>
62 #include <private/qdeclarativedirparser_p.h>
63 
65 
66 class QDeclarativeType;
69 
71 {
72 public:
73  static bool canCopy(int type);
74  static bool copy(int type, void *data, const void *copy = 0);
75 
76  static QList<QByteArray> qmlTypeNames();
77  static QList<QDeclarativeType*> qmlTypes();
78 
79  static QDeclarativeType *qmlType(const QByteArray &, int, int);
80  static QDeclarativeType *qmlType(const QMetaObject *);
81  static QDeclarativeType *qmlType(const QMetaObject *metaObject, const QByteArray &module, int version_major, int version_minor);
82  static QDeclarativeType *qmlType(int);
83 
84  static QDeclarativeDirComponents qmlComponents(const QByteArray& module, int version_major, int version_minor);
85 
86  static QMetaProperty defaultProperty(const QMetaObject *);
87  static QMetaProperty defaultProperty(QObject *);
88  static QMetaMethod defaultMethod(const QMetaObject *);
89  static QMetaMethod defaultMethod(QObject *);
90 
91  static bool isQObject(int);
92  static QObject *toQObject(const QVariant &, bool *ok = 0);
93 
94  static int listType(int);
95  static int attachedPropertiesFuncId(const QMetaObject *);
96  static QDeclarativeAttachedPropertiesFunc attachedPropertiesFuncById(int);
97 
98  enum TypeCategory { Unknown, Object, List };
99  static TypeCategory typeCategory(int);
100 
101  static bool isInterface(int);
102  static const char *interfaceIId(int);
103  static bool isList(int);
104 
105  typedef QVariant (*StringConverter)(const QString &);
106  static void registerCustomStringConverter(int, StringConverter);
107  static StringConverter customStringConverter(int);
108 
109  static bool isModule(const QByteArray &module, int versionMajor, int versionMinor);
110 
111  static QList<QDeclarativePrivate::AutoParentFunction> parentFunctions();
112 };
113 
115 {
116 public:
117  QByteArray typeName() const;
118  QByteArray qmlTypeName() const;
119 
120  QByteArray module() const;
121  int majorVersion() const;
122  int minorVersion() const;
123 
124  bool availableInVersion(int vmajor, int vminor) const;
125  bool availableInVersion(const QByteArray &module, int vmajor, int vminor) const;
126 
127  QObject *create() const;
128  void create(QObject **, void **, size_t) const;
129 
130  typedef void (*CreateFunc)(void *);
131  CreateFunc createFunction() const;
132  int createSize() const;
133 
134  QDeclarativeCustomParser *customParser() const;
135 
136  bool isCreatable() const;
137  bool isExtendedType() const;
138  QString noCreationReason() const;
139 
140  bool isInterface() const;
141  int typeId() const;
142  int qListTypeId() const;
143 
144  const QMetaObject *metaObject() const;
145  const QMetaObject *baseMetaObject() const;
146  int metaObjectRevision() const;
147  bool containsRevisionedAttributes() const;
148 
149  QDeclarativeAttachedPropertiesFunc attachedPropertiesFunction() const;
150  const QMetaObject *attachedPropertiesType() const;
151  int attachedPropertiesId() const;
152 
153  int parserStatusCast() const;
154  QVariant fromObject(QObject *) const;
155  const char *interfaceIId() const;
156  int propertyValueSourceCast() const;
157  int propertyValueInterceptorCast() const;
158 
159  int index() const;
160 
161 private:
162  QDeclarativeType *superType() const;
170  ~QDeclarativeType();
171 
173 };
174 
176 
177 #endif // QDECLARATIVEMETATYPE_P_H
178 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QObject *(* QDeclarativeAttachedPropertiesFunc)(QObject *)
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
int registerInterface(const QDeclarativePrivate::RegisterInterface &interface)
int type
Definition: qmetatype.cpp:239
int registerType(const QDeclarativePrivate::RegisterType &type)
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
QDeclarativeTypePrivate * d
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
const char * typeName
Definition: qmetatype.cpp:239
static const char * data(const QByteArray &arr)
#define Q_DECLARATIVE_PRIVATE_EXPORT
The QDeclarativeCustomParser class allows you to add new arbitrary types to QML.
quint16 index
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:176
int registerComponent(const QDeclarativePrivate::RegisterComponent &data)
The QMetaMethod class provides meta-data about a member function.
Definition: qmetaobject.h:56