miqt/qt/gen_qlockfile.cpp

59 lines
1.3 KiB
C++
Raw Normal View History

#include <QLockFile>
#include <QString>
2024-08-29 07:01:51 +00:00
#include <QByteArray>
#include <cstring>
#include "qlockfile.h"
2024-08-29 07:01:51 +00:00
#include "gen_qlockfile.h"
extern "C" {
extern void miqt_exec_callback(void* cb, int argc, void* argv);
}
QLockFile* QLockFile_new(const char* fileName, size_t fileName_Strlen) {
QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen);
return new QLockFile(fileName_QString);
}
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));
}
int QLockFile_StaleLockTime(QLockFile* self) {
2024-08-29 07:01:51 +00:00
return const_cast<const QLockFile*>(self)->staleLockTime();
}
bool QLockFile_IsLocked(QLockFile* self) {
2024-08-29 07:01:51 +00:00
return const_cast<const QLockFile*>(self)->isLocked();
}
bool QLockFile_RemoveStaleLockFile(QLockFile* self) {
return self->removeStaleLockFile();
}
2024-08-29 07:01:51 +00:00
uintptr_t QLockFile_Error(QLockFile* self) {
QLockFile::LockError ret = const_cast<const QLockFile*>(self)->error();
return static_cast<uintptr_t>(ret);
}
bool QLockFile_TryLock1(QLockFile* self, int timeout) {
return self->tryLock(static_cast<int>(timeout));
}
void QLockFile_Delete(QLockFile* self) {
delete self;
}