Qt 4.8
|
The QMetaEnum class provides meta-data about an enumerator. More...
#include <qmetaobject.h>
Public Functions | |
const QMetaObject * | enclosingMetaObject () const |
bool | isFlag () const |
Returns true if this enumerator is used as a flag; otherwise returns false. More... | |
bool | isValid () const |
Returns true if this enum is valid (has a name); otherwise returns false. More... | |
const char * | key (int index) const |
Returns the key with the given index, or 0 if no such key exists. More... | |
int | keyCount () const |
Returns the number of keys. More... | |
int | keysToValue (const char *keys) const |
Returns the value derived from combining together the values of the keys using the OR operator, or -1 if keys is not defined. More... | |
int | keyToValue (const char *key) const |
Returns the integer value of the given enumeration key, or -1 if key is not defined. More... | |
const char * | name () const |
Returns the name of the enumerator (without the scope). More... | |
QMetaEnum () | |
const char * | scope () const |
Returns the scope this enumerator was declared in. More... | |
int | value (int index) const |
Returns the value with the given index; or returns -1 if there is no such value. More... | |
const char * | valueToKey (int value) const |
Returns the string that is used as the name of the given enumeration value, or 0 if value is not defined. More... | |
QByteArray | valueToKeys (int value) const |
Returns a byte array of '|'-separated keys that represents the given value. More... | |
Properties | |
uint | handle |
const QMetaObject * | mobj |
Friends | |
struct | QMetaObject |
The QMetaEnum class provides meta-data about an enumerator.
Use name() for the enumerator's name. The enumerator's keys (names of each enumerated item) are returned by key(); use keyCount() to find the number of keys. isFlag() returns whether the enumerator is meant to be used as a flag, meaning that its values can be combined using the OR operator.
The conversion functions keyToValue(), valueToKey(), keysToValue(), and valueToKeys() allow conversion between the integer representation of an enumeration or set value and its literal representation. The scope() function returns the class scope this enumerator was declared in.
Definition at line 147 of file qmetaobject.h.
|
inline |
Definition at line 150 of file qmetaobject.h.
|
inline |
Definition at line 166 of file qmetaobject.h.
bool QMetaEnum::isFlag | ( | ) | const |
Returns true if this enumerator is used as a flag; otherwise returns false.
When used as flags, enumerators can be combined using the OR operator.
Definition at line 1935 of file qmetaobject.cpp.
Referenced by QMetaObjectBuilder::addEnumerator(), classIDL(), and QMetaProperty::isFlagType().
|
inline |
Returns true if this enum is valid (has a name); otherwise returns false.
Definition at line 168 of file qmetaobject.h.
Referenced by QScript::callQtMethod(), and QMetaObject::property().
const char * QMetaEnum::key | ( | int | index | ) | const |
Returns the key with the given index, or 0 if no such key exists.
Definition at line 1897 of file qmetaobject.cpp.
Referenced by QMetaObjectBuilder::addEnumerator(), classIDL(), QScript::QMetaObjectWrapperObject::deleteProperty(), QScript::QMetaObjectWrapperObject::getOwnPropertyDescriptor(), QScript::QMetaObjectWrapperObject::getOwnPropertyNames(), QScript::QMetaObjectWrapperObject::getOwnPropertySlot(), QScript::QMetaObjectWrapperObject::put(), and qax_generateDocumentation().
int QMetaEnum::keyCount | ( | ) | const |
Returns the number of keys.
Definition at line 1884 of file qmetaobject.cpp.
Referenced by QMetaObjectBuilder::addEnumerator(), classIDL(), QScript::QMetaObjectWrapperObject::deleteProperty(), QScript::QMetaObjectWrapperObject::getOwnPropertyDescriptor(), QScript::QMetaObjectWrapperObject::getOwnPropertyNames(), QScript::QMetaObjectWrapperObject::getOwnPropertySlot(), QScript::QMetaObjectWrapperObject::put(), and qax_generateDocumentation().
int QMetaEnum::keysToValue | ( | const char * | keys | ) | const |
Returns the value derived from combining together the values of the keys using the OR operator, or -1 if keys is not defined.
Note that the strings in keys must be '|'-separated.
Definition at line 2011 of file qmetaobject.cpp.
Referenced by QDeclarativeCompiler::genLiteralAssignment(), QDeclarativeCompiler::testLiteralAssignment(), QDeclarativeCompiler::testQualifiedEnumAssignment(), QMetaProperty::write(), and QDeclarativePropertyPrivate::writeEnumProperty().
int QMetaEnum::keyToValue | ( | const char * | key | ) | const |
Returns the integer value of the given enumeration key, or -1 if key is not defined.
For flag types, use keysToValue().
Definition at line 1962 of file qmetaobject.cpp.
Referenced by QScript::callQtMethod(), QAxBase::dynamicCallHelper(), QDeclarativeCompiler::evaluateEnum(), QDeclarativeCompiler::genLiteralAssignment(), QDeclarativeTypeNameScriptClass::queryProperty(), QDeclarativeCompiler::testLiteralAssignment(), QDeclarativeCompiler::testQualifiedEnumAssignment(), QMetaProperty::write(), and QDeclarativePropertyPrivate::writeEnumProperty().
const char * QMetaEnum::name | ( | ) | const |
Returns the name of the enumerator (without the scope).
For example, the Qt::AlignmentFlag enumeration has AlignmentFlag
as the name and Qt as the scope.
Definition at line 1872 of file qmetaobject.cpp.
Referenced by QMetaObjectBuilder::addEnumerator(), classIDL(), QDeclarativeObjectMethodScriptClass::enumType(), for(), QScript::indexOfMetaEnum(), QMetaProperty::isEnumType(), qax_generateDocumentation(), QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(), qualifiedName(), and QDeclarativePropertyPrivate::writeEnumProperty().
const char * QMetaEnum::scope | ( | ) | const |
Returns the scope this enumerator was declared in.
For example, the Qt::AlignmentFlag enumeration has Qt
as the scope and AlignmentFlag
as the name.
Definition at line 1949 of file qmetaobject.cpp.
Referenced by QDeclarativeObjectMethodScriptClass::enumType(), QScript::indexOfMetaEnum(), QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(), qualifiedName(), and QDeclarativePropertyPrivate::writeEnumProperty().
int QMetaEnum::value | ( | int | index | ) | const |
Returns the value with the given index; or returns -1 if there is no such value.
Definition at line 1914 of file qmetaobject.cpp.
Referenced by QMetaObjectBuilder::addEnumerator(), classIDL(), QScript::QMetaObjectWrapperObject::getOwnPropertyDescriptor(), QScript::QMetaObjectWrapperObject::getOwnPropertySlot(), and qax_generateDocumentation().
const char * QMetaEnum::valueToKey | ( | int | value | ) | const |
Returns the string that is used as the name of the given enumeration value, or 0 if value is not defined.
For flag types, use valueToKeys().
Definition at line 1992 of file qmetaobject.cpp.
Referenced by QScript::callQtMethod(), QAxBase::dynamicCallHelper(), QBBButtonEventNotifier::QBBButtonEventNotifier(), QmlJSDebugger::InspectorProtocol::toString(), and QGLEngineSharedShaders::~QGLEngineSharedShaders().
QByteArray QMetaEnum::valueToKeys | ( | int | value | ) | const |
Returns a byte array of '|'-separated keys that represents the given value.
Definition at line 2051 of file qmetaobject.cpp.
|
friend |
Definition at line 172 of file qmetaobject.h.
|
private |
Definition at line 171 of file qmetaobject.h.
Referenced by QMetaObject::enumerator().
|
private |
Definition at line 170 of file qmetaobject.h.
Referenced by QMetaObject::enumerator().