Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QMetaEnumBuilder Class Reference

\inmodule QtCore More...

#include <qmetaobjectbuilder_p.h>

+ Collaboration diagram for QMetaEnumBuilder:

Public Member Functions

 QMetaEnumBuilder ()
 
int index () const
 Returns the index of this enumerator within its QMetaObjectBuilder.
 
QByteArray name () const
 Returns the type name of the enumerator (without the scope).
 
QByteArray enumName () const
 Returns the enum name of the enumerator (without the scope).
 
void setEnumName (const QByteArray &alias)
 Sets this enumerator to have the enum name alias.
 
QMetaType metaType () const
 Returns the meta type of the enumerator.
 
void setMetaType (QMetaType metaType)
 Sets this enumerator to have the given metaType.
 
bool isFlag () const
 Returns true if this enumerator is used as a flag; otherwise returns false.
 
void setIsFlag (bool value)
 Sets this enumerator to be used as a flag if value is true.
 
bool isScoped () const
 Return true if this enumerator should be considered scoped (C++11 enum class).
 
void setIsScoped (bool value)
 Sets this enumerator to be a scoped enum if \value is true.
 
bool is64Bit () const
 Return true if this enumerations in this enumerator are 64-bit.
 
void setIs64Bit (bool value)
 Sets this enumerator to be 64-bit wide if value is true.
 
int keyCount () const
 Returns the number of keys.
 
QByteArray key (int index) const
 Returns the key with the given index, or an empty QByteArray if no such key exists.
 
int value (int index) const
 Returns the value with the given index; or returns -1 if there is no such value.
 
std::optional< quint64value64 (int index) const
 
int addKey (const QByteArray &name, int value)
 Adds a new key called name to this enumerator, associated with value.
 
int addKey (const QByteArray &name, quint64 value)
 
void removeKey (int index)
 Removes the key at index from this enumerator.
 

Friends

class QMetaObjectBuilder
 

Detailed Description

\inmodule QtCore

The QMetaEnumBuilder class enables modifications to an enumerator definition on a meta object builder.

Definition at line 249 of file qmetaobjectbuilder_p.h.

Constructor & Destructor Documentation

◆ QMetaEnumBuilder()

QMetaEnumBuilder::QMetaEnumBuilder ( )
inline

Definition at line 252 of file qmetaobjectbuilder_p.h.

Member Function Documentation

◆ addKey() [1/2]

int QMetaEnumBuilder::addKey ( const QByteArray & name,
int value )

Adds a new key called name to this enumerator, associated with value.

Returns the index of the new key.

See also
keyCount(), key(), value(), removeKey()

Definition at line 2511 of file qmetaobjectbuilder.cpp.

◆ addKey() [2/2]

int QMetaEnumBuilder::addKey ( const QByteArray & name,
quint64 value )
Since
6.9

Adds a new key called name to this enumerator, associated with value. Returns the index of the new key.

Using the 64-bit version of this function automatically makes this enumeration be stored as 64-bit.

See also
keyCount(), key(), value(), removeKey(), is64Bit()

Definition at line 2532 of file qmetaobjectbuilder.cpp.

◆ enumName()

QByteArray QMetaEnumBuilder::enumName ( ) const

Returns the enum name of the enumerator (without the scope).

Since
5.12

Definition at line 2306 of file qmetaobjectbuilder.cpp.

◆ index()

int QMetaEnumBuilder::index ( ) const
inline

Returns the index of this enumerator within its QMetaObjectBuilder.

Definition at line 254 of file qmetaobjectbuilder_p.h.

◆ is64Bit()

bool QMetaEnumBuilder::is64Bit ( ) const

Return true if this enumerations in this enumerator are 64-bit.

This flag is autoamtically enabled if a 64-bit value is added with addKey().

See also
setIs64Bit()

Definition at line 2415 of file qmetaobjectbuilder.cpp.

◆ isFlag()

bool QMetaEnumBuilder::isFlag ( ) const

Returns true if this enumerator is used as a flag; otherwise returns false.

See also
setIsFlag()

Definition at line 2362 of file qmetaobjectbuilder.cpp.

◆ isScoped()

bool QMetaEnumBuilder::isScoped ( ) const

Return true if this enumerator should be considered scoped (C++11 enum class).

See also
setIsScoped()

Definition at line 2388 of file qmetaobjectbuilder.cpp.

◆ key()

QByteArray QMetaEnumBuilder::key ( int index) const

Returns the key with the given index, or an empty QByteArray if no such key exists.

See also
keyCount(), addKey(), value()

Definition at line 2458 of file qmetaobjectbuilder.cpp.

◆ keyCount()

int QMetaEnumBuilder::keyCount ( ) const

Returns the number of keys.

See also
key(), addKey()

Definition at line 2443 of file qmetaobjectbuilder.cpp.

◆ metaType()

QMetaType QMetaEnumBuilder::metaType ( ) const

Returns the meta type of the enumerator.

Since
6.6

Definition at line 2333 of file qmetaobjectbuilder.cpp.

◆ name()

QByteArray QMetaEnumBuilder::name ( ) const

Returns the type name of the enumerator (without the scope).

Definition at line 2292 of file qmetaobjectbuilder.cpp.

◆ removeKey()

void QMetaEnumBuilder::removeKey ( int index)

Removes the key at index from this enumerator.

See also
addKey()

Definition at line 2547 of file qmetaobjectbuilder.cpp.

◆ setEnumName()

void QMetaEnumBuilder::setEnumName ( const QByteArray & alias)

Sets this enumerator to have the enum name alias.

Since
5.12
See also
isFlag(), enumName()

Definition at line 2321 of file qmetaobjectbuilder.cpp.

◆ setIs64Bit()

void QMetaEnumBuilder::setIs64Bit ( bool value)

Sets this enumerator to be 64-bit wide if value is true.

If value is false, any stored 64-bit keys will be truncated to 32 bits.

This flag is autoamtically enabled if a 64-bit value is added with addKey().

See also
is64Bit()

Definition at line 2431 of file qmetaobjectbuilder.cpp.

◆ setIsFlag()

void QMetaEnumBuilder::setIsFlag ( bool value)

Sets this enumerator to be used as a flag if value is true.

See also
isFlag()

Definition at line 2376 of file qmetaobjectbuilder.cpp.

◆ setIsScoped()

void QMetaEnumBuilder::setIsScoped ( bool value)

Sets this enumerator to be a scoped enum if \value is true.

See also
isScoped()

Definition at line 2401 of file qmetaobjectbuilder.cpp.

◆ setMetaType()

void QMetaEnumBuilder::setMetaType ( QMetaType metaType)

Sets this enumerator to have the given metaType.

The is64Bit() flag will be set to match metaType's size.

Since
6.6
See also
metaType()

Definition at line 2347 of file qmetaobjectbuilder.cpp.

◆ value()

int QMetaEnumBuilder::value ( int index) const

Returns the value with the given index; or returns -1 if there is no such value.

If this is a 64-bit enumeration (see is64Bit()), this function returns the low 32-bit portion of the value. Use value64() to obtain the full value instead.

See also
value64(), keyCount(), addKey(), key(), is64Bit()

Definition at line 2477 of file qmetaobjectbuilder.cpp.

◆ value64()

std::optional< quint64 > QMetaEnumBuilder::value64 ( int index) const
Since
6.9

Returns the value with the given index if it exists; or returns a disengaged {std::optional} if it doesn't.

qmetaenum-32bit-signextend-64bit

See also
keyCount(), key(), addKey()

Definition at line 2492 of file qmetaobjectbuilder.cpp.

Friends And Related Symbol Documentation

◆ QMetaObjectBuilder

friend class QMetaObjectBuilder
friend

Definition at line 286 of file qmetaobjectbuilder_p.h.


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