io.qt.internal.EnumFlags Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qtjambi Show documentation
Show all versions of qtjambi Show documentation
QtJambi base module containing QtCore, QtGui and QtWidgets.
package io.qt.internal;
import io.qt.*;
/**
* Java wrapper for Qt enum EnumFlags
* @hidden
*/
public enum EnumFlags implements QtFlagEnumerator {
/**
* Representing EnumIsFlag
*/
EnumIsFlag(1),
/**
* Representing EnumIsScoped
*/
EnumIsScoped(2);
static {
QtJambi_LibraryUtilities.initialize();
}
private EnumFlags(int value) {
this.value = value;
}
/**
* {@inheritDoc}
*/
public int value() {
return value;
}
/**
* Create a QFlags of the enum entry.
* @return QFlags
*/
public @NonNull EnumAttributes asFlags() {
return new EnumAttributes(value);
}
/**
* Combines this entry with other enum entry.
* @param e enum entry
* @return new flag
*/
public @NonNull EnumAttributes combined(@NonNull EnumFlags e) {
return asFlags().setFlag(e, true);
}
/**
* Excludes other enum entry from a flag of this entry.
* @param e enum entry
* @return new flag
*/
public @NonNull EnumAttributes cleared(@NonNull EnumFlags e) {
return asFlags().setFlag(e, false);
}
/**
* Creates a new {@link EnumAttributes} from the entries.
* @param values entries
* @return new flag
*/
public static @NonNull EnumAttributes flags(@Nullable EnumFlags @NonNull... values) {
return new EnumAttributes(values);
}
/**
* Returns the corresponding enum entry for the given value.
* @param value
* @return enum entry
*/
public static @NonNull EnumFlags resolve(int value) {
switch (value) {
case 1: return EnumIsFlag;
case 2: return EnumIsScoped;
default: throw new QNoSuchEnumValueException(value);
}
}
private final int value;
}