Qt 4.8
qdeclarativedata_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 QDECLARATIVEDATA_P_H
43 #define QDECLARATIVEDATA_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 <QtScript/qscriptvalue.h>
57 #include <private/qobject_p.h>
58 
60 
70 // This class is structured in such a way, that simply zero'ing it is the
71 // default state for elemental object allocations. This is crucial in the
72 // workings of the QDeclarativeInstruction::CreateSimpleObject instruction.
73 // Don't change anything here without first considering that case!
75 {
76 public:
78  : ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
79  context(0), outerContext(0), bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0),
80  bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0),
81  scriptValue(0), objectDataRefCount(0), propertyCache(0), guards(0), extendedData(0) {
82  init();
83  }
84 
85  static inline void init() {
89  }
90 
91  static void destroyed(QAbstractDeclarativeData *, QObject *);
94 
95  void destroyed(QObject *);
96  void parentChanged(QObject *, QObject *);
97  void objectNameChanged(QObject *);
98 
100  if (!explicitIndestructibleSet) indestructible = false;
101  }
102 
108 
109  // The context that created the C++ object
111  // The outermost context in which this object lives
113 
115 
116  // Linked list for QDeclarativeContext::contextObjects
119 
122  bool hasBindingBit(int) const;
123  void clearBindingBit(int);
124  void setBindingBit(QObject *obj, int);
125 
128 
129  QDeclarativeCompiledData *deferredComponent; // Can't this be found from the context?
130  unsigned int deferredIdx;
131 
132  // ### Can we make this QScriptValuePrivate so we incur no additional allocation
133  // cost?
137 
139 
140  static QDeclarativeData *get(const QObject *object, bool create = false) {
141  QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
142  if (priv->wasDeleted) {
143  Q_ASSERT(!create);
144  return 0;
145  } else if (priv->declarativeData) {
146  return static_cast<QDeclarativeData *>(priv->declarativeData);
147  } else if (create) {
148  priv->declarativeData = new QDeclarativeData;
149  return static_cast<QDeclarativeData *>(priv->declarativeData);
150  } else {
151  return 0;
152  }
153  }
154 
155  bool hasExtendedData() const { return extendedData != 0; }
156  QDeclarativeNotifier *objectNameNotifier() const;
157  QHash<int, QObject *> *attachedProperties() const;
158  void addBoundSignal(QDeclarativeAbstractBoundSignal *signal);
159  void removeBoundSignal(QDeclarativeAbstractBoundSignal *signal);
160  void disconnectNotifiers();
161 
162 private:
163  // For objectNameNotifier, attachedProperties and bound signal list
165 };
166 
168 
169 #endif // QDECLARATIVEDATA_P_H
QDeclarativeContextData * outerContext
QDeclarativeContextData * context
QDeclarativePropertyCache * propertyCache
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
QDeclarativeAbstractBinding * bindings
uint wasDeleted
Definition: qobject.h:98
static void init()
unsigned int deferredIdx
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
static void(* objectNameChanged)(QAbstractDeclarativeData *, QObject *)
Definition: qobject_p.h:95
static QObjectPrivate * get(QObject *o)
Definition: qobject_p.h:177
QDeclarativeDataExtended * extendedData
QDeclarativeCompiledData * deferredComponent
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
static bool init
quint32 explicitIndestructibleSet
QAbstractDeclarativeData * declarativeData
Definition: qobject_p.h:214
bool hasExtendedData() const
unsigned short ushort
Definition: qglobal.h:995
static void(* parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *)
Definition: qobject_p.h:94
unsigned int quint32
Definition: qglobal.h:938
static const QMetaObjectPrivate * priv(const uint *data)
static void(* destroyed)(QAbstractDeclarativeData *, QObject *)
Definition: qobject_p.h:93
#define Q_AUTOTEST_EXPORT
Definition: qglobal.h:1510
The QDeclarativeContext class defines a context within a QML engine.
QDeclarativeData ** prevContextObject
QDeclarativeData * nextContextObject
QDeclarativeGuardImpl * guards
QScriptValue * scriptValue
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57