
io.qt.core.QIODeviceBase Maven / Gradle / Ivy
package io.qt.core;
import io.qt.*;
/**
* Base class for QIODevice that provides flags describing the mode in which a device is opened
* Java wrapper for Qt class QIODeviceBase
*/
public interface QIODeviceBase extends QtObjectInterface
{
/**
* Java wrapper for Qt enum QIODeviceBase::OpenModeFlag
*
* @see OpenMode
*/
public enum OpenModeFlag implements QtFlagEnumerator {
/**
* Representing QIODeviceBase:: NotOpen
*/
NotOpen(0),
/**
* Representing QIODeviceBase:: ReadOnly
*/
ReadOnly(1),
/**
* Representing QIODeviceBase:: WriteOnly
*/
WriteOnly(2),
/**
* Representing QIODeviceBase:: ReadWrite
*/
ReadWrite(3),
/**
* Representing QIODeviceBase:: Append
*/
Append(4),
/**
* Representing QIODeviceBase:: Truncate
*/
Truncate(8),
/**
* Representing QIODeviceBase:: Text
*/
Text(16),
/**
* Representing QIODeviceBase:: Unbuffered
*/
Unbuffered(32),
/**
* Representing QIODeviceBase:: NewOnly
*/
NewOnly(64),
/**
* Representing QIODeviceBase:: ExistingOnly
*/
ExistingOnly(128);
static {
QtJambi_LibraryUtilities.initialize();
}
private OpenModeFlag(int value) {
this.value = value;
}
/**
* {@inheritDoc}
*/
public int value() {
return value;
}
/**
* Create a QFlags of the enum entry.
* @return QFlags
*/
public @NonNull OpenMode asFlags() {
return new OpenMode(value);
}
/**
* Combines this entry with other enum entry.
* @param e enum entry
* @return new flag
*/
public @NonNull OpenMode combined(@NonNull OpenModeFlag 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 OpenMode cleared(@NonNull OpenModeFlag e) {
return asFlags().setFlag(e, false);
}
/**
* Creates a new {@link OpenMode} from the entries.
* @param values entries
* @return new flag
*/
public static @NonNull OpenMode flags(@Nullable OpenModeFlag @NonNull... values) {
return new OpenMode(values);
}
/**
* Returns the corresponding enum entry for the given value.
* @param value
* @return enum entry
*/
public static @NonNull OpenModeFlag resolve(int value) {
switch (value) {
case 0: return NotOpen;
case 1: return ReadOnly;
case 2: return WriteOnly;
case 3: return ReadWrite;
case 4: return Append;
case 8: return Truncate;
case 16: return Text;
case 32: return Unbuffered;
case 64: return NewOnly;
case 128: return ExistingOnly;
default: throw new QNoSuchEnumValueException(value);
}
}
private final int value;
}
/**
* {@link QFlags} type for enum {@link OpenModeFlag}
*/
public static final class OpenMode extends QFlags implements Comparable {
private static final long serialVersionUID = 0x6416216da160206aL;
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Creates a new OpenMode where the flags in args
are set.
* @param args enum entries
*/
public OpenMode(@Nullable OpenModeFlag @NonNull... args){
super(args);
}
/**
* Creates a new OpenMode with given value
.
* @param value
*/
public OpenMode(int value) {
super(value);
}
/**
* Combines this flags with enum entry.
* @param e enum entry
* @return new OpenMode
*/
@Override
public final @NonNull OpenMode combined(@StrictNonNull OpenModeFlag e){
return new OpenMode(value() | e.value());
}
/**
* Sets the flag e
* @param e enum entry
* @return this
*/
public final @NonNull OpenMode setFlag(@Nullable OpenModeFlag e){
return setFlag(e, true);
}
/**
* Sets or clears the flag flag
* @param e enum entry
* @param on set (true) or clear (false)
* @return this
*/
public final @NonNull OpenMode setFlag(@Nullable OpenModeFlag e, boolean on){
if (on) {
setValue(value() | e.value());
}else {
setValue(value() & ~e.value());
}
return this;
}
/**
* Returns an array of flag objects represented by this OpenMode.
* @return array of enum entries
*/
@Override
public final @NonNull OpenModeFlag @NonNull[] flags(){
return super.flags(OpenModeFlag.values());
}
/**
* {@inheritDoc}
*/
@Override
public final @NonNull OpenMode clone(){
return new OpenMode(value());
}
/**
* {@inheritDoc}
*/
@Override
public final int compareTo(@StrictNonNull OpenMode other){
return Integer.compare(value(), other.value());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy