io.qt.core.QLockFile Maven / Gradle / Ivy
Show all versions of qtjambi Show documentation
package io.qt.core;
import io.qt.*;
/**
* Locking between processes using a file
* Java wrapper for Qt class QLockFile
*/
public class QLockFile extends QtObject
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Java wrapper for Qt enum QLockFile::LockError
*/
public enum LockError implements QtEnumerator {
/**
* Representing QLockFile:: NoError
*/
NoError(0),
/**
* Representing QLockFile:: LockFailedError
*/
LockFailedError(1),
/**
* Representing QLockFile:: PermissionError
*/
PermissionError(2),
/**
* Representing QLockFile:: UnknownError
*/
UnknownError(3);
static {
QtJambi_LibraryUtilities.initialize();
}
private LockError(int value) {
this.value = value;
}
/**
* {@inheritDoc}
*/
public int value() {
return value;
}
/**
* Returns the corresponding enum entry for the given value.
* @param value
* @return enum entry
*/
public static @NonNull LockError resolve(int value) {
switch (value) {
case 0: return NoError;
case 1: return LockFailedError;
case 2: return PermissionError;
case 3: return UnknownError;
default: throw new QNoSuchEnumValueException(value);
}
}
private final int value;
}
/**
* See QLockFile:: QLockFile(QString)
*/
public QLockFile(java.lang.@NonNull String fileName){
super((QPrivateConstructor)null);
initialize_native(this, fileName);
}
private native static void initialize_native(QLockFile instance, java.lang.String fileName);
/**
*
*/
@QtUninvokable
public final io.qt.core.QLockFile.@NonNull LockError error(){
return io.qt.core.QLockFile.LockError.resolve(error_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)));
}
@QtUninvokable
private native int error_native_constfct(long __this__nativeId);
/**
* See QLockFile:: fileName()const
*/
@QtUninvokable
public final java.lang.@NonNull String fileName(){
return fileName_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.lang.String fileName_native_constfct(long __this__nativeId);
/**
* See QLockFile:: getLockInfo(qint64*, QString*, QString*)const
*/
@QtUninvokable
public final io.qt.core.QLockFile.@StrictNonNull LockInfo getLockInfo(){
return getLockInfo_native_qint64_ptr_QString_ptr_QString_ptr_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QLockFile.LockInfo getLockInfo_native_qint64_ptr_QString_ptr_QString_ptr_constfct(long __this__nativeId);
/**
* See QLockFile:: isLocked()const
*/
@QtUninvokable
public final boolean isLocked(){
return isLocked_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isLocked_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final boolean lock(){
return lock_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean lock_native(long __this__nativeId);
/**
* See QLockFile:: removeStaleLockFile()
*/
@QtUninvokable
public final boolean removeStaleLockFile(){
return removeStaleLockFile_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean removeStaleLockFile_native(long __this__nativeId);
/**
* See QLockFile:: setStaleLockTime(int)
*/
@QtUninvokable
public final void setStaleLockTime(int arg__1){
setStaleLockTime_native_int(QtJambi_LibraryUtilities.internal.nativeId(this), arg__1);
}
@QtUninvokable
private native void setStaleLockTime_native_int(long __this__nativeId, int arg__1);
/**
* See QLockFile:: setStaleLockTime(std::chrono::milliseconds)
*/
@QtUninvokable
public final void setStaleLockTime(java.time.temporal.@NonNull TemporalAmount value){
setStaleLockTime_native_std_chrono_milliseconds(QtJambi_LibraryUtilities.internal.nativeId(this), value);
}
@QtUninvokable
private native void setStaleLockTime_native_std_chrono_milliseconds(long __this__nativeId, java.time.temporal.TemporalAmount value);
/**
* See QLockFile:: staleLockTime()const
*/
@QtUninvokable
public final int staleLockTime(){
return staleLockTime_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native int staleLockTime_native_constfct(long __this__nativeId);
/**
* See QLockFile:: staleLockTimeAsDuration()const
*/
@QtUninvokable
public final java.time.@NonNull Duration staleLockTimeAsDuration(){
return staleLockTimeAsDuration_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.time.Duration staleLockTimeAsDuration_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final boolean tryLock(int timeout){
return tryLock_native_int(QtJambi_LibraryUtilities.internal.nativeId(this), timeout);
}
@QtUninvokable
private native boolean tryLock_native_int(long __this__nativeId, int timeout);
/**
* See QLockFile:: tryLock(std::chrono::milliseconds)
*/
@QtUninvokable
public final boolean tryLock(java.time.temporal.@NonNull TemporalAmount timeout){
return tryLock_native_std_chrono_milliseconds(QtJambi_LibraryUtilities.internal.nativeId(this), timeout);
}
@QtUninvokable
private native boolean tryLock_native_std_chrono_milliseconds(long __this__nativeId, java.time.temporal.TemporalAmount timeout);
/**
*
*/
@QtUninvokable
public final void unlock(){
unlock_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native void unlock_native(long __this__nativeId);
/**
* Constructor for internal use only.
* @param p expected to be null
.
* @hidden
*/
@NativeAccess
protected QLockFile(QPrivateConstructor p) { super(p); }
/**
* Result class for {@link #getLockInfo()}
*/
public static class LockInfo {
private LockInfo(long pid, String hostname, String appname) {
this.pid = pid;
this.hostname = hostname;
this.appname = appname;
}
public final long pid;
public final @NonNull String hostname;
public final @NonNull String appname;
}
/**
* Overloaded function for {@link #tryLock(java.time.temporal.TemporalAmount)}
* with timeout = java.time.Duration.ZERO
.
*/
@QtUninvokable
public final boolean tryLock() {
return tryLock(java.time.Duration.ZERO);
}
}