Qt 4.8
Public Types | Public Functions | Private Functions | Properties | List of all members
QDeclarativeFastProperties Class Reference

#include <qdeclarativefastproperties_p.h>

Public Types

typedef void(* Accessor) (QObject *object, void *output, QDeclarativeNotifierEndpoint *endpoint)
 

Public Functions

Accessor accessor (int index) const
 
int accessorIndexForProperty (const QMetaObject *, int)
 
 QDeclarativeFastProperties ()
 

Private Functions

void add (const QMetaObject *, int, Accessor)
 

Properties

QVector< Accessorm_accessors
 
QHash< QPair< const QMetaObject *, int >, int > m_index
 

Detailed Description

Definition at line 54 of file qdeclarativefastproperties_p.h.

Typedefs

◆ Accessor

typedef void(* QDeclarativeFastProperties::Accessor) (QObject *object, void *output, QDeclarativeNotifierEndpoint *endpoint)

Definition at line 57 of file qdeclarativefastproperties_p.h.

Constructors and Destructors

◆ QDeclarativeFastProperties()

QDeclarativeFastProperties::QDeclarativeFastProperties ( )

Definition at line 61 of file qdeclarativefastproperties.cpp.

62 {
65  add(&QObject::staticMetaObject, QObject::staticMetaObject.indexOfProperty("objectName"),
67 }
void add(const QMetaObject *, int, Accessor)
static void QObject_objectName(QObject *object, void *output, QDeclarativeNotifierEndpoint *endpoint)
static const QMetaObject staticMetaObject
This variable stores the meta-object for the class.
Definition: qobject.h:128
static void parentProperty(QObject *o, void *rv, QDeclarativeNotifierEndpoint *e)

Functions

◆ accessor()

Accessor QDeclarativeFastProperties::accessor ( int  index) const
inline

Definition at line 61 of file qdeclarativefastproperties_p.h.

61 { return m_accessors.at(index); }
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
quint16 index

◆ accessorIndexForProperty()

int QDeclarativeFastProperties::accessorIndexForProperty ( const QMetaObject metaObject,
int  propertyIndex 
)

Definition at line 69 of file qdeclarativefastproperties.cpp.

Referenced by accessor().

70 {
71  Q_ASSERT(metaObject);
72  Q_ASSERT(propertyIndex >= 0);
73 
74  // Find the "real" metaObject
75  while (metaObject->propertyOffset() > propertyIndex)
76  metaObject = metaObject->superClass();
77 
78  QHash<QPair<const QMetaObject *, int>, int>::Iterator iter =
79  m_index.find(qMakePair(metaObject, propertyIndex));
80  if (iter != m_index.end())
81  return *iter;
82  else
83  return -1;
84 }
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
const QMetaObject * superClass() const
Returns the meta-object of the superclass, or 0 if there is no such object.
Definition: qobjectdefs.h:494
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
QHash< QPair< const QMetaObject *, int >, int > m_index
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Definition: qpair.h:102
int propertyOffset() const
Returns the property offset for this class; i.e.
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865

◆ add()

void QDeclarativeFastProperties::add ( const QMetaObject metaObject,
int  propertyIndex,
Accessor  accessor 
)
private

Definition at line 86 of file qdeclarativefastproperties.cpp.

Referenced by accessor(), and QDeclarativeFastProperties().

87 {
88  Q_ASSERT(metaObject);
89  Q_ASSERT(propertyIndex >= 0);
90 
91  // Find the "real" metaObject
92  while (metaObject->propertyOffset() > propertyIndex)
93  metaObject = metaObject->superClass();
94 
95  QPair<const QMetaObject *, int> data = qMakePair(metaObject, propertyIndex);
96  int accessorIndex = m_accessors.count();
98  m_index.insert(data, accessorIndex);
99 }
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
Accessor accessor(int index) const
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
static const char * data(const QByteArray &arr)
const QMetaObject * superClass() const
Returns the meta-object of the superclass, or 0 if there is no such object.
Definition: qobjectdefs.h:494
QHash< QPair< const QMetaObject *, int >, int > m_index
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Definition: qpair.h:102
int propertyOffset() const
Returns the property offset for this class; i.e.

Properties

◆ m_accessors

QVector<Accessor> QDeclarativeFastProperties::m_accessors
private

Definition at line 68 of file qdeclarativefastproperties_p.h.

Referenced by accessor(), and add().

◆ m_index

QHash<QPair<const QMetaObject *, int>, int> QDeclarativeFastProperties::m_index
private

Definition at line 67 of file qdeclarativefastproperties_p.h.

Referenced by accessorIndexForProperty(), and add().


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