Qt 4.8
Classes | Public Functions | Static Public Functions | Protected Functions | Private Types | Private Functions | Properties | Friends | List of all members
QDeclarativePropertyCache Class Reference

#include <qdeclarativepropertycache_p.h>

Inheritance diagram for QDeclarativePropertyCache:
QDeclarativeRefCount QDeclarativeCleanup

Classes

struct  Data
 
struct  RData
 
struct  ValueTypeData
 

Public Functions

void append (QDeclarativeEngine *, const QMetaObject *, Data::Flag propertyFlags=Data::NoFlags, Data::Flag methodFlags=Data::NoFlags, Data::Flag signalFlags=Data::NoFlags)
 
void append (QDeclarativeEngine *, const QMetaObject *, int revision, Data::Flag propertyFlags=Data::NoFlags, Data::Flag methodFlags=Data::NoFlags, Data::Flag signalFlags=Data::NoFlags)
 
QDeclarativePropertyCachecopy () const
 
bool isAllowedInRevision (Data *) const
 
Datamethod (int) const
 
DataoverrideData (Data *) const
 
Dataproperty (const QScriptDeclarativeClass::Identifier &id) const
 
Dataproperty (const QString &) const
 
Dataproperty (int) const
 
QStringList propertyNames () const
 
 QDeclarativePropertyCache (QDeclarativeEngine *)
 Creates a new empty QDeclarativePropertyCache. More...
 
 QDeclarativePropertyCache (QDeclarativeEngine *, const QMetaObject *)
 Creates a new QDeclarativePropertyCache of metaObject. More...
 
QDeclarativeEngineqmlEngine () const
 
void update (QDeclarativeEngine *, const QMetaObject *)
 
virtual ~QDeclarativePropertyCache ()
 
- Public Functions inherited from QDeclarativeRefCount
void addref ()
 
 QDeclarativeRefCount ()
 
void release ()
 
virtual ~QDeclarativeRefCount ()
 
- Public Functions inherited from QDeclarativeCleanup
 QDeclarativeCleanup (QDeclarativeEngine *)
 
virtual ~QDeclarativeCleanup ()
 

Static Public Functions

static Data create (const QMetaObject *, const QString &)
 
static Dataproperty (QDeclarativeEngine *, QObject *, const QScriptDeclarativeClass::Identifier &, Data &)
 
static Dataproperty (QDeclarativeEngine *, QObject *, const QString &, Data &)
 

Protected Functions

virtual void clear ()
 

Private Types

typedef QVector< int > AllowedRevisionCache
 
typedef QHash< QScriptDeclarativeClass::Identifier, RData * > IdentifierCache
 
typedef QVector< RData * > IndexCache
 
typedef QHash< QString, RData * > StringCache
 

Private Functions

void updateRecur (QDeclarativeEngine *, const QMetaObject *)
 

Properties

AllowedRevisionCache allowedRevisionCache
 
QDeclarativeEngineengine
 
IdentifierCache identifierCache
 
IndexCache indexCache
 
IndexCache methodIndexCache
 
StringCache stringCache
 

Friends

class QDeclarativeEnginePrivate
 

Detailed Description

Definition at line 68 of file qdeclarativepropertycache_p.h.

Typedefs

◆ AllowedRevisionCache

Definition at line 169 of file qdeclarativepropertycache_p.h.

◆ IdentifierCache

Definition at line 168 of file qdeclarativepropertycache_p.h.

◆ IndexCache

Definition at line 166 of file qdeclarativepropertycache_p.h.

◆ StringCache

Definition at line 167 of file qdeclarativepropertycache_p.h.

Constructors and Destructors

◆ QDeclarativePropertyCache() [1/2]

QDeclarativePropertyCache::QDeclarativePropertyCache ( QDeclarativeEngine e)

Creates a new empty QDeclarativePropertyCache.

Definition at line 117 of file qdeclarativepropertycache.cpp.

Referenced by copy().

119 {
120  Q_ASSERT(engine);
121 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QDeclarativeCleanup(QDeclarativeEngine *)

◆ QDeclarativePropertyCache() [2/2]

QDeclarativePropertyCache::QDeclarativePropertyCache ( QDeclarativeEngine e,
const QMetaObject metaObject 
)

Creates a new QDeclarativePropertyCache of metaObject.

Definition at line 126 of file qdeclarativepropertycache.cpp.

128 {
129  Q_ASSERT(engine);
130  Q_ASSERT(metaObject);
131 
132  update(engine, metaObject);
133 }
void update(QDeclarativeEngine *, const QMetaObject *)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QDeclarativeCleanup(QDeclarativeEngine *)

◆ ~QDeclarativePropertyCache()

QDeclarativePropertyCache::~QDeclarativePropertyCache ( )
virtual

Definition at line 135 of file qdeclarativepropertycache.cpp.

136 {
137  clear();
138 }

Functions

◆ append() [1/2]

void QDeclarativePropertyCache::append ( QDeclarativeEngine engine,
const QMetaObject metaObject,
Data::Flag  propertyFlags = Data::NoFlags,
Data::Flag  methodFlags = Data::NoFlags,
Data::Flag  signalFlags = Data::NoFlags 
)

Definition at line 237 of file qdeclarativepropertycache.cpp.

Referenced by QDeclarativeCompiler::buildDynamicMeta(), QDeclarativeEnginePrivate::createCache(), and updateRecur().

239 {
240  append(engine, metaObject, -1, propertyFlags, methodFlags, signalFlags);
241 }
void append(QDeclarativeEngine *, const QMetaObject *, Data::Flag propertyFlags=Data::NoFlags, Data::Flag methodFlags=Data::NoFlags, Data::Flag signalFlags=Data::NoFlags)

◆ append() [2/2]

void QDeclarativePropertyCache::append ( QDeclarativeEngine engine,
const QMetaObject metaObject,
int  revision,
Data::Flag  propertyFlags = Data::NoFlags,
Data::Flag  methodFlags = Data::NoFlags,
Data::Flag  signalFlags = Data::NoFlags 
)

Definition at line 243 of file qdeclarativepropertycache.cpp.

246 {
247  Q_UNUSED(revision);
248 
250 
252  int methodCount = metaObject->methodCount();
253  // 3 to block the destroyed signal and the deleteLater() slot
254  int methodOffset = qMax(3, metaObject->methodOffset());
255 
256  methodIndexCache.resize(methodCount);
257  for (int ii = methodOffset; ii < methodCount; ++ii) {
258  QMetaMethod m = metaObject->method(ii);
259  if (m.access() == QMetaMethod::Private)
260  continue;
262 
263  int parenIdx = methodName.indexOf(QLatin1Char('('));
264  Q_ASSERT(parenIdx != -1);
265  methodName = methodName.left(parenIdx);
266 
267  RData *data = new RData;
268  data->identifier = enginePriv->objectClass->createPersistentIdentifier(methodName);
269  methodIndexCache[ii] = data;
270 
271  data->load(m);
273  data->flags |= methodFlags;
274  else if (m.methodType() == QMetaMethod::Signal)
275  data->flags |= signalFlags;
276 
277  data->metaObjectOffset = allowedRevisionCache.count() - 1;
278 
279  if (stringCache.contains(methodName)) {
280  RData *old = stringCache[methodName];
281  // We only overload methods in the same class, exactly like C++
282  if (old->flags & Data::IsFunction && old->coreIndex >= methodOffset)
283  data->relatedIndex = old->coreIndex;
284  data->overrideIndexIsProperty = !bool(old->flags & Data::IsFunction);
285  data->overrideIndex = old->coreIndex;
286  stringCache[methodName]->release();
287  identifierCache[data->identifier.identifier]->release();
288  }
289 
290  stringCache.insert(methodName, data);
291  identifierCache.insert(data->identifier.identifier, data);
292  data->addref();
293  data->addref();
294  }
295 
296  int propCount = metaObject->propertyCount();
297  int propOffset = metaObject->propertyOffset();
298 
299  indexCache.resize(propCount);
300  for (int ii = propOffset; ii < propCount; ++ii) {
301  QMetaProperty p = metaObject->property(ii);
302  if (!p.isScriptable())
303  continue;
304 
305  QString propName = QString::fromUtf8(p.name());
306 
307  RData *data = new RData;
308  data->identifier = enginePriv->objectClass->createPersistentIdentifier(propName);
309  indexCache[ii] = data;
310 
311  data->load(p, engine);
312  data->flags |= propertyFlags;
313 
314  data->metaObjectOffset = allowedRevisionCache.count() - 1;
315 
316  if (stringCache.contains(propName)) {
317  RData *old = stringCache[propName];
318  data->overrideIndexIsProperty = !bool(old->flags & Data::IsFunction);
319  data->overrideIndex = old->coreIndex;
320  stringCache[propName]->release();
321  identifierCache[data->identifier.identifier]->release();
322  }
323 
324  stringCache.insert(propName, data);
325  identifierCache.insert(data->identifier.identifier, data);
326  data->addref();
327  data->addref();
328  }
329 }
bool isScriptable(const QObject *obj=0) const
Returns true if the property is scriptable for the given object; otherwise returns false...
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
int propertyCount() const
Returns the number of properties in this class, including the number of properties provided by each b...
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
Definition: qhash.h:872
PersistentIdentifier createPersistentIdentifier(const QString &)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
void resize(int size)
Sets the size of the vector to size.
Definition: qvector.h:342
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
int methodOffset() const
Returns the method offset for this class; i.e.
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Definition: qstring.cpp:4302
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
QDeclarativeObjectScriptClass * objectClass
MethodType methodType() const
Returns the type of this method (signal, slot, or method).
const char * name() const
Returns this property&#39;s name.
static QByteArray methodName(const char *signature, int nameLength)
Makes a deep copy of the first nameLength characters of the given method signature and returns the co...
if(void) toggleToolbarShown
QMetaMethod method(int index) const
Returns the meta-data for the method with the given index.
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:176
int propertyOffset() const
Returns the property offset for this class; i.e.
const char * signature() const
Returns the signature of this method (e.g., setValue(double)).
Access access() const
Returns the access specification of this method (private, protected, or public).
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
int methodCount() const
Returns the number of methods known to the meta-object system in this class, including the number of ...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
The QMetaMethod class provides meta-data about a member function.
Definition: qmetaobject.h:56
QMetaProperty property(int index) const
Returns the meta-data for the property with the given index.

◆ clear()

void QDeclarativePropertyCache::clear ( )
protectedvirtual

Implements QDeclarativeCleanup.

Definition at line 140 of file qdeclarativepropertycache.cpp.

Referenced by update(), and ~QDeclarativePropertyCache().

141 {
142  for (int ii = 0; ii < indexCache.count(); ++ii) {
143  if (indexCache.at(ii)) indexCache.at(ii)->release();
144  }
145 
146  for (int ii = 0; ii < methodIndexCache.count(); ++ii) {
147  RData *data = methodIndexCache.at(ii);
148  if (data) data->release();
149  }
150 
152  iter != stringCache.end(); ++iter) {
153  RData *data = (*iter);
154  data->release();
155  }
156 
157  for (IdentifierCache::ConstIterator iter = identifierCache.begin();
158  iter != identifierCache.end(); ++iter) {
159  RData *data = (*iter);
160  data->release();
161  }
162 
163  indexCache.clear();
165  stringCache.clear();
166  identifierCache.clear();
167 }
void clear()
Removes all items from the hash.
Definition: qhash.h:574
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
const_iterator ConstIterator
Qt-style synonym for QHash::const_iterator.
Definition: qhash.h:474
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
Definition: qvector.h:347
static const char * data(const QByteArray &arr)
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:464

◆ copy()

QDeclarativePropertyCache * QDeclarativePropertyCache::copy ( ) const

Definition at line 214 of file qdeclarativepropertycache.cpp.

Referenced by QDeclarativeEnginePrivate::createCache().

215 {
217  cache->indexCache = indexCache;
219  cache->stringCache = stringCache;
222 
223  for (int ii = 0; ii < indexCache.count(); ++ii) {
224  if (indexCache.at(ii)) indexCache.at(ii)->addref();
225  }
226  for (int ii = 0; ii < methodIndexCache.count(); ++ii) {
227  if (methodIndexCache.at(ii)) methodIndexCache.at(ii)->addref();
228  }
229  for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter)
230  (*iter)->addref();
231  for (IdentifierCache::ConstIterator iter = identifierCache.begin(); iter != identifierCache.end(); ++iter)
232  (*iter)->addref();
233 
234  return cache;
235 }
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
const_iterator ConstIterator
Qt-style synonym for QHash::const_iterator.
Definition: qhash.h:474
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:464
QDeclarativePropertyCache(QDeclarativeEngine *)
Creates a new empty QDeclarativePropertyCache.

◆ create()

QDeclarativePropertyCache::Data QDeclarativePropertyCache::create ( const QMetaObject metaObject,
const QString property 
)
static

Definition at line 169 of file qdeclarativepropertycache.cpp.

Referenced by property().

171 {
172  Q_ASSERT(metaObject);
173 
175  {
176  const QMetaObject *cmo = metaObject;
177  while (cmo) {
178  int idx = metaObject->indexOfProperty(property.toUtf8());
179  if (idx != -1) {
180  QMetaProperty p = metaObject->property(idx);
181  if (p.isScriptable()) {
182  rv.load(metaObject->property(idx));
183  return rv;
184  } else {
185  while (cmo && cmo->propertyOffset() >= idx)
186  cmo = cmo->superClass();
187  }
188  } else {
189  cmo = 0;
190  }
191  }
192  }
193 
194  int methodCount = metaObject->methodCount();
195  for (int ii = methodCount - 1; ii >= 3; --ii) { // >=3 to block the destroyed signal and deleteLater() slot
196  QMetaMethod m = metaObject->method(ii);
197  if (m.access() == QMetaMethod::Private)
198  continue;
200 
201  int parenIdx = methodName.indexOf(QLatin1Char('('));
202  Q_ASSERT(parenIdx != -1);
203  QStringRef methodNameRef = methodName.leftRef(parenIdx);
204 
205  if (methodNameRef == property) {
206  rv.load(m);
207  return rv;
208  }
209  }
210 
211  return rv;
212 }
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
bool isScriptable(const QObject *obj=0) const
Returns true if the property is scriptable for the given object; otherwise returns false...
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
Definition: qstring.cpp:4074
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
int indexOfProperty(const char *name) const
Finds property name and returns its index; otherwise returns -1.
QStringRef leftRef(int n) const Q_REQUIRED_RESULT
Returns a substring reference to the n leftmost characters of the string.
Definition: qstring.cpp:9045
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Definition: qstring.cpp:4302
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
void load(const QMetaProperty &, QDeclarativeEngine *engine=0)
const QMetaObject * superClass() const
Returns the meta-object of the superclass, or 0 if there is no such object.
Definition: qobjectdefs.h:494
The QStringRef class provides a thin wrapper around QString substrings.
Definition: qstring.h:1099
static QByteArray methodName(const char *signature, int nameLength)
Makes a deep copy of the first nameLength characters of the given method signature and returns the co...
QMetaMethod method(int index) const
Returns the meta-data for the method with the given index.
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:176
int propertyOffset() const
Returns the property offset for this class; i.e.
const char * signature() const
Returns the signature of this method (e.g., setValue(double)).
Access access() const
Returns the access specification of this method (private, protected, or public).
int methodCount() const
Returns the number of methods known to the meta-object system in this class, including the number of ...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
The QMetaMethod class provides meta-data about a member function.
Definition: qmetaobject.h:56
QMetaProperty property(int index) const
Returns the meta-data for the property with the given index.

◆ isAllowedInRevision()

bool QDeclarativePropertyCache::isAllowedInRevision ( Data data) const
inline

Definition at line 227 of file qdeclarativepropertycache_p.h.

Referenced by QDeclarativeEnginePrivate::createCache(), QDeclarativeCompiler::indexOfProperty(), QDeclarativeCompiler::indexOfSignal(), and QDeclarativeObjectScriptClass::queryProperty().

228 {
229  return (data->metaObjectOffset == -1 && data->revision == 0) ||
230  (allowedRevisionCache[data->metaObjectOffset] >= data->revision);
231 }
static const char * data(const QByteArray &arr)

◆ method()

QDeclarativePropertyCache::Data * QDeclarativePropertyCache::method ( int  index) const

Definition at line 365 of file qdeclarativepropertycache.cpp.

Referenced by flush_vme_signal(), and QDeclarativeObjectMethodScriptClass::relatedMethod().

366 {
367  if (index < 0 || index >= methodIndexCache.count())
368  return 0;
369 
370  return methodIndexCache.at(index);
371 }
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
quint16 index

◆ overrideData()

QDeclarativePropertyCache::Data * QDeclarativePropertyCache::overrideData ( Data data) const
inline

Definition at line 198 of file qdeclarativepropertycache_p.h.

Referenced by QDeclarativeCompiler::indexOfProperty(), and QDeclarativeCompiler::indexOfSignal().

199 {
200  if (data->overrideIndex < 0)
201  return 0;
202 
203  if (data->overrideIndexIsProperty)
204  return indexCache.at(data->overrideIndex);
205  else
206  return methodIndexCache.at(data->overrideIndex);
207 }
static const char * data(const QByteArray &arr)
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350

◆ property() [1/5]

QDeclarativePropertyCache::Data * QDeclarativePropertyCache::property ( const QScriptDeclarativeClass::Identifier id) const
inline

◆ property() [2/5]

QDeclarativePropertyCache::Data * QDeclarativePropertyCache::property ( const QString str) const

Definition at line 374 of file qdeclarativepropertycache.cpp.

375 {
376  return stringCache.value(str);
377 }
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606

◆ property() [3/5]

QDeclarativePropertyCache::Data * QDeclarativePropertyCache::property ( int  index) const

Definition at line 356 of file qdeclarativepropertycache.cpp.

357 {
358  if (index < 0 || index >= indexCache.count())
359  return 0;
360 
361  return indexCache.at(index);
362 }
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
quint16 index

◆ property() [4/5]

QDeclarativePropertyCache::Data * QDeclarativePropertyCache::property ( QDeclarativeEngine engine,
QObject obj,
const QScriptDeclarativeClass::Identifier name,
Data local 
)
static

Definition at line 411 of file qdeclarativepropertycache.cpp.

413 {
415 
417 
418  QDeclarativePropertyCache *cache = 0;
420  if (ddata && ddata->propertyCache && ddata->propertyCache->qmlEngine() == engine)
421  cache = ddata->propertyCache;
422  if (!cache) {
423  cache = enginePrivate->cache(obj);
424  if (cache && ddata && !ddata->propertyCache) { cache->addref(); ddata->propertyCache = cache; }
425  }
426 
427  if (cache) {
428  rv = cache->property(name);
429  } else {
430  local = QDeclarativePropertyCache::create(obj->metaObject(), enginePrivate->objectClass->toString(name));
431  if (local.isValid())
432  rv = &local;
433  }
434 
435  return rv;
436 }
QDeclarativePropertyCache * propertyCache
static QDeclarativeData * get(const QObject *object, bool create=false)
QDeclarativePropertyCache * cache(QObject *obj)
Returns a QDeclarativePropertyCache for obj if one is available.
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
static Data create(const QMetaObject *, const QString &)
const char * name
Data * property(const QScriptDeclarativeClass::Identifier &id) const
QDeclarativeEngine * qmlEngine() const
QDeclarativeObjectScriptClass * objectClass
if(void) toggleToolbarShown
QString toString(const Identifier &)
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.

◆ property() [5/5]

QDeclarativePropertyCache::Data * QDeclarativePropertyCache::property ( QDeclarativeEngine engine,
QObject obj,
const QString name,
Data local 
)
static

Definition at line 438 of file qdeclarativepropertycache.cpp.

440 {
442 
443  if (!engine) {
445  if (local.isValid())
446  rv = &local;
447  } else {
449 
450  QDeclarativePropertyCache *cache = 0;
452  if (ddata && ddata->propertyCache && ddata->propertyCache->qmlEngine() == engine)
453  cache = ddata->propertyCache;
454  if (!cache) {
455  cache = enginePrivate->cache(obj);
456  if (cache && ddata && !ddata->propertyCache) { cache->addref(); ddata->propertyCache = cache; }
457  }
458 
459  if (cache) {
460  rv = cache->property(name);
461  } else {
463  if (local.isValid())
464  rv = &local;
465  }
466  }
467 
468  return rv;
469 }
QDeclarativePropertyCache * propertyCache
static QDeclarativeData * get(const QObject *object, bool create=false)
QDeclarativePropertyCache * cache(QObject *obj)
Returns a QDeclarativePropertyCache for obj if one is available.
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
static Data create(const QMetaObject *, const QString &)
const char * name
Data * property(const QScriptDeclarativeClass::Identifier &id) const
QDeclarativeEngine * qmlEngine() const
if(void) toggleToolbarShown
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.

◆ propertyNames()

QStringList QDeclarativePropertyCache::propertyNames ( ) const

Definition at line 406 of file qdeclarativepropertycache.cpp.

Referenced by QDeclarativeObjectScriptClass::propertyNames().

407 {
408  return stringCache.keys();
409 }
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
Definition: qhash.h:648

◆ qmlEngine()

QDeclarativeEngine * QDeclarativePropertyCache::qmlEngine ( ) const
inline

Definition at line 233 of file qdeclarativepropertycache_p.h.

Referenced by property().

234 {
235  return engine;
236 }

◆ update()

void QDeclarativePropertyCache::update ( QDeclarativeEngine engine,
const QMetaObject metaObject 
)

Definition at line 341 of file qdeclarativepropertycache.cpp.

Referenced by QDeclarativeOpenMetaObjectType::createProperty(), and QDeclarativePropertyCache().

342 {
343  Q_ASSERT(engine);
344  Q_ASSERT(metaObject);
345 
346  clear();
347 
348  // Optimization to prevent unnecessary reallocation of lists
349  indexCache.reserve(metaObject->propertyCount());
350  methodIndexCache.reserve(metaObject->methodCount());
351 
352  updateRecur(engine,metaObject);
353 }
void updateRecur(QDeclarativeEngine *, const QMetaObject *)
int propertyCount() const
Returns the number of properties in this class, including the number of properties provided by each b...
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void reserve(int size)
Attempts to allocate memory for at least size elements.
Definition: qvector.h:339
int methodCount() const
Returns the number of methods known to the meta-object system in this class, including the number of ...

◆ updateRecur()

void QDeclarativePropertyCache::updateRecur ( QDeclarativeEngine engine,
const QMetaObject metaObject 
)
private

Definition at line 331 of file qdeclarativepropertycache.cpp.

Referenced by update().

332 {
333  if (!metaObject)
334  return;
335 
336  updateRecur(engine, metaObject->superClass());
337 
338  append(engine, metaObject);
339 }
void updateRecur(QDeclarativeEngine *, const QMetaObject *)
const QMetaObject * superClass() const
Returns the meta-object of the superclass, or 0 if there is no such object.
Definition: qobjectdefs.h:494
void append(QDeclarativeEngine *, const QMetaObject *, Data::Flag propertyFlags=Data::NoFlags, Data::Flag methodFlags=Data::NoFlags, Data::Flag signalFlags=Data::NoFlags)

Friends and Related Functions

◆ QDeclarativeEnginePrivate

Definition at line 160 of file qdeclarativepropertycache_p.h.

Properties

◆ allowedRevisionCache

AllowedRevisionCache QDeclarativePropertyCache::allowedRevisionCache
private

◆ engine

QDeclarativeEngine* QDeclarativePropertyCache::engine
private

◆ identifierCache

IdentifierCache QDeclarativePropertyCache::identifierCache
private

Definition at line 177 of file qdeclarativepropertycache_p.h.

Referenced by append(), clear(), copy(), and property().

◆ indexCache

IndexCache QDeclarativePropertyCache::indexCache
private

Definition at line 174 of file qdeclarativepropertycache_p.h.

Referenced by append(), clear(), copy(), overrideData(), property(), and update().

◆ methodIndexCache

IndexCache QDeclarativePropertyCache::methodIndexCache
private

Definition at line 175 of file qdeclarativepropertycache_p.h.

Referenced by append(), clear(), copy(), method(), overrideData(), and update().

◆ stringCache

StringCache QDeclarativePropertyCache::stringCache
private

The documentation for this class was generated from the following files: