Struct qt_core::QMetaEnum

source ·
#[repr(C)]
pub struct QMetaEnum { /* private fields */ }
Expand description

The QMetaEnum class provides meta-data about an enumerator.

C++ class: QMetaEnum.

C++ documentation:

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.

Implementations§

source§

impl QMetaEnum

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QMetaEnum>> ) -> Ref<QMetaEnum>

The QMetaEnum class provides meta-data about an enumerator.

Calls C++ function: QMetaEnum& QMetaEnum::operator=(const QMetaEnum& other).

C++ documentation:

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.

source

pub unsafe fn enclosing_meta_object(&self) -> Ptr<QMetaObject>

Calls C++ function: const QMetaObject* QMetaEnum::enclosingMetaObject() const.

source

pub unsafe fn enum_name(&self) -> *const c_char

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

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

Calls C++ function: const char* QMetaEnum::enumName() const.

C++ documentation:

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

For example, the Qt::AlignmentFlag flag has AlignmentFlag as the enum name, but Alignment as as the type name. Non flag enums has the same type and enum names.

Enum names have the same scope as the type name.

This function was introduced in Qt 5.12.

See also isValid() and name().

source

pub unsafe fn is_flag(&self) -> bool

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

Calls C++ function: bool QMetaEnum::isFlag() const.

C++ documentation:

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.

See also keysToValue() and valueToKeys().

source

pub unsafe fn is_scoped(&self) -> bool

Returns true if this enumerator is declared as a C++11 enum class; otherwise returns false.

Calls C++ function: bool QMetaEnum::isScoped() const.

C++ documentation:

Returns true if this enumerator is declared as a C++11 enum class; otherwise returns false.

This function was introduced in Qt 5.8.

source

pub unsafe fn is_valid(&self) -> bool

Returns true if this enum is valid (has a name); otherwise returns false.

Calls C++ function: bool QMetaEnum::isValid() const.

C++ documentation:

Returns true if this enum is valid (has a name); otherwise returns false.

See also name().

source

pub unsafe fn key(&self, index: c_int) -> *const c_char

Returns the key with the given index, or 0 if no such key exists.

Calls C++ function: const char* QMetaEnum::key(int index) const.

C++ documentation:

Returns the key with the given index, or 0 if no such key exists.

See also keyCount(), value(), and valueToKey().

source

pub unsafe fn key_count(&self) -> c_int

Returns the number of keys.

Calls C++ function: int QMetaEnum::keyCount() const.

C++ documentation:

Returns the number of keys.

See also key().

source

pub unsafe fn key_to_value_2a(&self, key: *const c_char, ok: *mut bool) -> c_int

Returns the integer value of the given enumeration key, or -1 if key is not defined.

Calls C++ function: int QMetaEnum::keyToValue(const char* key, bool* ok = …) const.

C++ documentation:

Returns the integer value of the given enumeration key, or -1 if key is not defined.

If key is not defined, *ok is set to false; otherwise *ok is set to true.

For flag types, use keysToValue().

See also valueToKey(), isFlag(), and keysToValue().

source

pub unsafe fn key_to_value_1a(&self, key: *const c_char) -> c_int

Returns the integer value of the given enumeration key, or -1 if key is not defined.

Calls C++ function: int QMetaEnum::keyToValue(const char* key) const.

C++ documentation:

Returns the integer value of the given enumeration key, or -1 if key is not defined.

If key is not defined, *ok is set to false; otherwise *ok is set to true.

For flag types, use keysToValue().

See also valueToKey(), isFlag(), and keysToValue().

source

pub unsafe fn keys_to_value_2a( &self, keys: *const c_char, ok: *mut bool ) -> c_int

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.

Calls C++ function: int QMetaEnum::keysToValue(const char* keys, bool* ok = …) const.

C++ documentation:

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.

If keys is not defined, *ok is set to false; otherwise *ok is set to true.

See also isFlag(), valueToKey(), and valueToKeys().

source

pub unsafe fn keys_to_value_1a(&self, keys: *const c_char) -> c_int

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.

Calls C++ function: int QMetaEnum::keysToValue(const char* keys) const.

C++ documentation:

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.

If keys is not defined, *ok is set to false; otherwise *ok is set to true.

See also isFlag(), valueToKey(), and valueToKeys().

source

pub unsafe fn name(&self) -> *const c_char

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

Calls C++ function: const char* QMetaEnum::name() const.

C++ documentation:

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.

See also isValid() and scope().

source

pub unsafe fn new() -> CppBox<QMetaEnum>

Calls C++ function: [constructor] void QMetaEnum::QMetaEnum().

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QMetaEnum>> ) -> CppBox<QMetaEnum>

The QMetaEnum class provides meta-data about an enumerator.

Calls C++ function: [constructor] void QMetaEnum::QMetaEnum(const QMetaEnum& other).

C++ documentation:

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.

source

pub unsafe fn scope(&self) -> *const c_char

Returns the scope this enumerator was declared in.

Calls C++ function: const char* QMetaEnum::scope() const.

C++ documentation:

Returns the scope this enumerator was declared in.

For example, the Qt::AlignmentFlag enumeration has Qt as the scope and AlignmentFlag as the name.

See also name().

source

pub unsafe fn value(&self, index: c_int) -> c_int

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

Calls C++ function: int QMetaEnum::value(int index) const.

C++ documentation:

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

See also keyCount(), key(), and keyToValue().

source

pub unsafe fn value_to_key(&self, value: c_int) -> *const c_char

Returns the string that is used as the name of the given enumeration value, or 0 if value is not defined.

Calls C++ function: const char* QMetaEnum::valueToKey(int value) const.

C++ documentation:

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().

See also isFlag() and valueToKeys().

source

pub unsafe fn value_to_keys(&self, value: c_int) -> CppBox<QByteArray>

Returns a byte array of '|'-separated keys that represents the given value.

Calls C++ function: QByteArray QMetaEnum::valueToKeys(int value) const.

C++ documentation:

Returns a byte array of ‘|’-separated keys that represents the given value.

See also isFlag(), valueToKey(), and keysToValue().

Trait Implementations§

source§

impl CppDeletable for QMetaEnum

source§

unsafe fn delete(&self)

The QMetaEnum class provides meta-data about an enumerator.

Calls C++ function: [destructor] void QMetaEnum::~QMetaEnum().

C++ documentation:

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.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.