All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.qt.core.QMetaEnum Maven / Gradle / Ivy

There is a newer version: 6.8.0
Show newest version
package io.qt.core;

import io.qt.*;


/**
 * 

Meta-data about an enumerator

*

Java wrapper for Qt class QMetaEnum

*/ public class QMetaEnum extends QtObject implements java.lang.Cloneable { static { QtJambi_LibraryUtilities.initialize(); } /** *

See QMetaEnum::QMetaEnum()

*/ public QMetaEnum(){ super((QPrivateConstructor)null); initialize_native(this); } private native static void initialize_native(QMetaEnum instance); /** *

See QMetaEnum::QMetaEnum(QMetaEnum)

*/ public QMetaEnum(io.qt.core.@NonNull QMetaEnum other){ super((QPrivateConstructor)null); initialize_native(this, other); } private native static void initialize_native(QMetaEnum instance, io.qt.core.QMetaEnum other); /** *

See QMetaEnum::enclosingMetaObject()const

*/ @QtUninvokable public final io.qt.core.@Nullable QMetaObject enclosingMetaObject(){ return enclosingMetaObject_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native io.qt.core.QMetaObject enclosingMetaObject_native_constfct(long __this__nativeId); /** *

See QMetaEnum::enumName()const

*/ @QtUninvokable public final java.lang.@Nullable String enumName(){ return enumName_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native java.lang.String enumName_native_constfct(long __this__nativeId); /** *

See QMetaEnum::isFlag()const

*/ @QtUninvokable public final boolean isFlag(){ return isFlag_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native boolean isFlag_native_constfct(long __this__nativeId); /** *

See QMetaEnum::isScoped()const

*/ @QtUninvokable public final boolean isScoped(){ return isScoped_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native boolean isScoped_native_constfct(long __this__nativeId); /** *

See QMetaEnum::isValid()const

*/ @QtUninvokable public final boolean isValid(){ return isValid_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native boolean isValid_native_constfct(long __this__nativeId); /** *

See QMetaEnum::key(int)const

*/ @QtUninvokable public final java.lang.@Nullable String key(int index){ return key_native_int_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), index); } @QtUninvokable private native java.lang.String key_native_int_constfct(long __this__nativeId, int index); /** *

See QMetaEnum::keyCount()const

*/ @QtUninvokable public final int keyCount(){ return keyCount_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native int keyCount_native_constfct(long __this__nativeId); /** *

See QMetaEnum::keyToValue(const char*,bool*)const

*/ @QtUninvokable public final java.lang.@Nullable Integer keyToValue(java.lang.@Nullable String key){ return keyToValue_native_const_char_ptr_bool_ptr_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), key); } @QtUninvokable private native java.lang.@Nullable Integer keyToValue_native_const_char_ptr_bool_ptr_constfct(long __this__nativeId, java.lang.String key); /** *

See QMetaEnum::keysToValue(const char*,bool*)const

*/ @QtUninvokable public final java.lang.@Nullable Integer keysToValue(java.lang.@Nullable String keys){ return keysToValue_native_const_char_ptr_bool_ptr_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), keys); } @QtUninvokable private native java.lang.@Nullable Integer keysToValue_native_const_char_ptr_bool_ptr_constfct(long __this__nativeId, java.lang.String keys); /** *

See QMetaEnum::metaType()const

*/ @QtUninvokable public final io.qt.core.@NonNull QMetaType metaType(){ return metaType_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native io.qt.core.QMetaType metaType_native_constfct(long __this__nativeId); /** *

See QMetaEnum::name()const

*/ @QtUninvokable public final java.lang.@Nullable String name(){ return name_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native java.lang.String name_native_constfct(long __this__nativeId); /** *

See operator==(QMetaEnum,QMetaEnum)

*/ @QtUninvokable public final boolean equals(io.qt.core.@NonNull QMetaEnum value2){ return equals_native_cref_QMetaEnum(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(value2)); } @QtUninvokable private native boolean equals_native_cref_QMetaEnum(long __this__nativeId, long value2); /** *

See QMetaEnum::scope()const

*/ @QtUninvokable public final java.lang.@Nullable String scope(){ return scope_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native java.lang.String scope_native_constfct(long __this__nativeId); /** *

See QMetaEnum::value(int)const

*/ @QtUninvokable public final int value(int index){ return value_native_int_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), index); } @QtUninvokable private native int value_native_int_constfct(long __this__nativeId, int index); /** *

See QMetaEnum::valueToKey(int)const

*/ @QtUninvokable public final java.lang.@Nullable String valueToKey(int value){ return valueToKey_native_int_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), value); } @QtUninvokable private native java.lang.String valueToKey_native_int_constfct(long __this__nativeId, int value); /** *

See QMetaEnum::valueToKeys(int)const

*/ @QtUninvokable public final io.qt.core.@NonNull QByteArray valueToKeys(int value){ return valueToKeys_native_int_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), value); } @QtUninvokable private native io.qt.core.QByteArray valueToKeys_native_int_constfct(long __this__nativeId, int value); /** * Constructor for internal use only. * @param p expected to be null. * @hidden */ @NativeAccess protected QMetaEnum(QPrivateConstructor p) { super(p); } /** *

See operator==(QMetaEnum,QMetaEnum)

*/ @Override @QtUninvokable public boolean equals(Object other) { if (other instanceof io.qt.core.QMetaEnum) { return equals((io.qt.core.QMetaEnum) other); } return false; } /** * Returns the objects's hash code computed by qHash(QMetaEnum). */ @QtUninvokable @Override public int hashCode() { return hashCode_native(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native static int hashCode_native(long __this_nativeId); @Override @QtUninvokable public final @NonNull String toString() { return name(); } /** *

See QMetaEnum::keysToValue(const char *) const

*/ @QtUninvokable public @Nullable Integer keysToValue(String... keys) { return keysToValue(new QStringList(keys).join('|')); } /** *

See QMetaEnum::keysToValue(const char *) const

*/ @QtUninvokable public @Nullable Integer keysToValue(java.util.@StrictNonNull Collection<@NonNull String> keys) { return keysToValue((keys instanceof QStringList ? (QStringList)keys : new QStringList(keys)).join('|')); } /** * Returns all enum entries of this enum type. */ @QtUninvokable public io.qt.@NonNull QtAbstractEnumerator @Nullable[] entries() { return enclosingMetaObject().enumEntries(this); } /** * Returns the enum entry of the given value. */ @QtUninvokable public io.qt.@Nullable QtAbstractEnumerator entry(int index) { return enclosingMetaObject().enumEntry(this, index); } /** * Returns the enum entry of the given name. */ @QtUninvokable public io.qt.@Nullable QtAbstractEnumerator entry(String name) { return enclosingMetaObject().enumEntry(this, name); } /** * Returns the java class of this enum type. */ @QtUninvokable public @Nullable Class type() { return enclosingMetaObject().enumType(this); } @QtUninvokable @NativeAccess private static Class flagsType(Class enumType){ try { Class result = enumType.getMethod("asFlags").getReturnType(); if(result==QFlags.class && enumType.getDeclaringClass()!=null) { for(Class cls : enumType.getDeclaringClass().getDeclaredClasses()) { if(QFlags.class.isAssignableFrom(cls)) { if(cls.getGenericSuperclass() instanceof java.lang.reflect.ParameterizedType) { java.lang.reflect.ParameterizedType pt = (java.lang.reflect.ParameterizedType)cls.getGenericSuperclass(); if(pt.getRawType()==QFlags.class) { java.lang.reflect.Type[] types = pt.getActualTypeArguments(); if(types.length==1 && types[0]==enumType) return cls; } } } } } return result; } catch (Exception e) { return null; } } /** * Returns flags for the given value. */ @QtUninvokable public io.qt.@Nullable QFlags flags(int value) { Class enumType = type(); if(QtFlagEnumerator.class.isAssignableFrom(enumType)) { Class flagsType = flagsType(enumType); if(flagsType!=null) return flags(flagsType, value); }else if(QFlags.class.isAssignableFrom(enumType)) { return flags(enumType, value); } return null; } /** * Returns flags for the given enum names. */ @QtUninvokable public io.qt.@Nullable QFlags flags(String... names) { @SuppressWarnings("unchecked") QFlags flags = (QFlags)flags(0); if(flags!=null){ for (String name : names) { QtAbstractEnumerator entry = entry(name); if(entry instanceof QtFlagEnumerator) { flags.set((QtFlagEnumerator)entry); }else { throw new QNoSuchEnumValueException(name); } } } return flags; } @QtUninvokable private static native QFlags flags(Class cls, int value); /** * Returns the enum entry of the given value. */ @QtUninvokable public io.qt.@Nullable QtAbstractEnumerator resolve(int value) { Class type = type(); if(type.isEnum()) { byte bitSize = 4; if(QtByteEnumerator.class.isAssignableFrom(type)) { bitSize = 1; }else if(QtShortEnumerator.class.isAssignableFrom(type)) { bitSize = 2; }else if(QtLongEnumerator.class.isAssignableFrom(type)) { bitSize = 8; } return resolveEntry(type, value, bitSize); }else { return enclosingMetaObject().getEnumEntry(this, value); } } @QtUninvokable private static native QtAbstractEnumerator resolveEntry(Class cls, int value, byte bitSize); /** *

Creates and returns a copy of this object.

See QMetaEnum::QMetaEnum(QMetaEnum)

*/ @QtUninvokable @Override public QMetaEnum clone() { return clone_native(QtJambi_LibraryUtilities.internal.nativeId(this)); } private static native QMetaEnum clone_native(long __this_nativeId); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy