2024-08-25 04:08:24 +00:00
|
|
|
#include <QLockFile>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qlockfile.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qlockfile.h"
|
2024-12-11 06:55:47 +00:00
|
|
|
|
|
|
|
#ifndef _Bool
|
|
|
|
#define _Bool bool
|
|
|
|
#endif
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QLockFile* QLockFile_new(struct miqt_string fileName) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
2024-12-07 04:15:57 +00:00
|
|
|
return new QLockFile(fileName_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QLockFile_Lock(QLockFile* self) {
|
|
|
|
return self->lock();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QLockFile_TryLock(QLockFile* self) {
|
|
|
|
return self->tryLock();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QLockFile_Unlock(QLockFile* self) {
|
|
|
|
self->unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QLockFile_SetStaleLockTime(QLockFile* self, int staleLockTime) {
|
|
|
|
self->setStaleLockTime(static_cast<int>(staleLockTime));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QLockFile_StaleLockTime(const QLockFile* self) {
|
|
|
|
return self->staleLockTime();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QLockFile_IsLocked(const QLockFile* self) {
|
|
|
|
return self->isLocked();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QLockFile_RemoveStaleLockFile(QLockFile* self) {
|
|
|
|
return self->removeStaleLockFile();
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QLockFile_Error(const QLockFile* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QLockFile::LockError _ret = self->error();
|
2024-09-18 00:12:02 +00:00
|
|
|
return static_cast<int>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
bool QLockFile_TryLock1(QLockFile* self, int timeout) {
|
|
|
|
return self->tryLock(static_cast<int>(timeout));
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
void QLockFile_Delete(QLockFile* self, bool isSubclass) {
|
|
|
|
if (isSubclass) {
|
|
|
|
delete dynamic_cast<QLockFile*>( self );
|
|
|
|
} else {
|
|
|
|
delete self;
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|