Qt 4.8
Public Types | Public Functions | Static Public Functions | Public Variables | List of all members
QDeclarativePropertyCache::Data Struct Reference

#include <qdeclarativepropertycache_p.h>

Inheritance diagram for QDeclarativePropertyCache::Data:
QDeclarativePropertyCache::RData

Public Types

enum  Flag {
  NoFlags = 0x00000000, IsConstant = 0x00000001, IsWritable = 0x00000002, IsResettable = 0x00000004,
  IsAlias = 0x00000008, IsFunction = 0x00000010, IsQObjectDerived = 0x00000020, IsEnumType = 0x00000040,
  IsQList = 0x00000080, IsQmlBinding = 0x00000100, IsQScriptValue = 0x00000200, IsVMEFunction = 0x00000400,
  HasArguments = 0x00000800, IsSignal = 0x00001000, IsVMESignal = 0x00002000
}
 

Public Functions

 Data ()
 
bool isValid () const
 
void load (const QMetaProperty &, QDeclarativeEngine *engine=0)
 
void load (const QMetaMethod &)
 
QString name (QObject *)
 
QString name (const QMetaObject *)
 
bool operator== (const Data &)
 

Static Public Functions

static Flags flagsForProperty (const QMetaProperty &, QDeclarativeEngine *engine=0)
 

Public Variables

union {
   int   notifyIndex
 
   int   relatedIndex
 
}; 
 
int coreIndex
 
Flags flags
 
int metaObjectOffset
 
signed int overrideIndex: 31
 
uint overrideIndexIsProperty: 1
 
int propType
 
int revision
 

Detailed Description

Definition at line 75 of file qdeclarativepropertycache_p.h.

Enumerations

◆ Flag

Enumerator
NoFlags 
IsConstant 
IsWritable 
IsResettable 
IsAlias 
IsFunction 
IsQObjectDerived 
IsEnumType 
IsQList 
IsQmlBinding 
IsQScriptValue 
IsVMEFunction 
HasArguments 
IsSignal 
IsVMESignal 

Definition at line 79 of file qdeclarativepropertycache_p.h.

79  {
80  NoFlags = 0x00000000,
81 
82  // Can apply to all properties, except IsFunction
83  IsConstant = 0x00000001,
84  IsWritable = 0x00000002,
85  IsResettable = 0x00000004,
86  IsAlias = 0x00000008,
87 
88  // These are mutualy exclusive
89  IsFunction = 0x00000010,
90  IsQObjectDerived = 0x00000020,
91  IsEnumType = 0x00000040,
92  IsQList = 0x00000080,
93  IsQmlBinding = 0x00000100,
94  IsQScriptValue = 0x00000200,
95 
96  // Apply only to IsFunctions
97  IsVMEFunction = 0x00000400,
98  HasArguments = 0x00000800,
99  IsSignal = 0x00001000,
100  IsVMESignal = 0x00002000
101  };

Constructors and Destructors

◆ Data()

QDeclarativePropertyCache::Data::Data ( )
inline

Functions

◆ flagsForProperty()

QDeclarativePropertyCache::Data::Flags QDeclarativePropertyCache::Data::flagsForProperty ( const QMetaProperty p,
QDeclarativeEngine engine = 0 
)
static

Definition at line 52 of file qdeclarativepropertycache.cpp.

Referenced by QDeclarativePropertyPrivate::initProperty(), load(), and QDeclarativePropertyPrivate::saveValueType().

53 {
54  int propType = p.userType();
55 
56  Flags flags;
57 
58  if (p.isConstant())
59  flags |= Data::IsConstant;
60  if (p.isWritable())
61  flags |= Data::IsWritable;
62  if (p.isResettable())
63  flags |= Data::IsResettable;
64 
65  if (propType == qMetaTypeId<QDeclarativeBinding *>()) {
66  flags |= Data::IsQmlBinding;
67  } else if (propType == qMetaTypeId<QScriptValue>()) {
68  flags |= Data::IsQScriptValue;
69  } else if (p.isEnumType()) {
70  flags |= Data::IsEnumType;
71  } else {
75  flags |= Data::IsQObjectDerived;
76  else if (cat == QDeclarativeMetaType::List)
77  flags |= Data::IsQList;
78  }
79 
80  return flags;
81 }
bool isWritable() const
Returns true if this property is writable; otherwise returns false.
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
static TypeCategory typeCategory(int)
bool isEnumType() const
Returns true if the property&#39;s type is an enumeration value; otherwise returns false.
int userType() const
Returns this property&#39;s user type.
QDeclarativeMetaType::TypeCategory typeCategory(int) const
bool isResettable() const
Returns true if this property can be reset to a default value; otherwise returns false.
Flags
bool isConstant() const

◆ isValid()

bool QDeclarativePropertyCache::Data::isValid ( ) const
inline

◆ load() [1/2]

void QDeclarativePropertyCache::Data::load ( const QMetaProperty p,
QDeclarativeEngine engine = 0 
)

Definition at line 83 of file qdeclarativepropertycache.cpp.

Referenced by QDeclarativePropertyCache::append(), QDeclarativePropertyCache::create(), QDeclarativeObjectMethodScriptClass::relatedMethod(), QDeclarativePropertyPrivate::saveProperty(), and QDeclarativePropertyPrivate::saveValueType().

84 {
85  propType = p.userType();
87  propType = qMetaTypeId<QVariant>();
90  flags = flagsForProperty(p, engine);
91  revision = p.revision();
92 }
int notifySignalIndex() const
Returns the index of the property change notifying signal if one was specified, otherwise returns -1...
int propertyIndex() const
Returns this property&#39;s index.
int userType() const
Returns this property&#39;s user type.
Type
This enum type defines the types of variable that a QVariant can contain.
Definition: qvariant.h:95
int revision() const
Returns the property revision if one was specified by REVISION, otherwise returns 0...
static Flags flagsForProperty(const QMetaProperty &, QDeclarativeEngine *engine=0)

◆ load() [2/2]

void QDeclarativePropertyCache::Data::load ( const QMetaMethod m)

Definition at line 94 of file qdeclarativepropertycache.cpp.

95 {
96  coreIndex = m.methodIndex();
97  relatedIndex = -1;
102 
103  const char *returnType = m.typeName();
104  if (returnType)
105  propType = QMetaType::type(returnType);
106 
107  QList<QByteArray> params = m.parameterTypes();
108  if (!params.isEmpty())
110  revision = m.revision();
111 }
int methodIndex() const
Returns this method&#39;s index.
const char * typeName() const
Returns the return type of this method, or an empty string if the return type is void.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
static int type(const char *typeName)
Returns a handle to the type called typeName, or 0 if there is no such type.
Definition: qmetatype.cpp:607
MethodType methodType() const
Returns the type of this method (signal, slot, or method).
QList< QByteArray > parameterTypes() const
Returns a list of parameter types.
int revision() const
Returns the method revision if one was specified by Q_REVISION, otherwise returns 0...

◆ name() [1/2]

QString QDeclarativePropertyCache::Data::name ( QObject object)

Definition at line 379 of file qdeclarativepropertycache.cpp.

Referenced by QDeclarativeProperty::name().

380 {
381  if (!object)
382  return QString();
383 
384  return name(object->metaObject());
385 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.

◆ name() [2/2]

QString QDeclarativePropertyCache::Data::name ( const QMetaObject metaObject)

Definition at line 387 of file qdeclarativepropertycache.cpp.

388 {
389  if (!metaObject || coreIndex == -1)
390  return QString();
391 
392  if (flags & IsFunction) {
393  QMetaMethod m = metaObject->method(coreIndex);
394 
396  int parenIdx = name.indexOf(QLatin1Char('('));
397  if (parenIdx != -1)
398  name = name.left(parenIdx);
399  return name;
400  } else {
401  QMetaProperty p = metaObject->property(coreIndex);
402  return QString::fromUtf8(p.name());
403  }
404 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
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
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
const char * name() const
Returns this property&#39;s name.
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
const char * signature() const
Returns the signature of this method (e.g., setValue(double)).
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.

◆ operator==()

bool QDeclarativePropertyCache::Data::operator== ( const Data other)
inline

Definition at line 188 of file qdeclarativepropertycache_p.h.

189 {
190  return flags == other.flags &&
191  propType == other.propType &&
192  coreIndex == other.coreIndex &&
193  notifyIndex == other.notifyIndex &&
194  revision == other.revision;
195 }

Properties

◆ @151

union { ... }

◆ coreIndex

int QDeclarativePropertyCache::Data::coreIndex

◆ flags

Flags QDeclarativePropertyCache::Data::flags

◆ metaObjectOffset

int QDeclarativePropertyCache::Data::metaObjectOffset

◆ notifyIndex

int QDeclarativePropertyCache::Data::notifyIndex

◆ overrideIndex

signed int QDeclarativePropertyCache::Data::overrideIndex

◆ overrideIndexIsProperty

uint QDeclarativePropertyCache::Data::overrideIndexIsProperty

◆ propType

int QDeclarativePropertyCache::Data::propType

◆ relatedIndex

int QDeclarativePropertyCache::Data::relatedIndex

◆ revision

int QDeclarativePropertyCache::Data::revision

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