miqt/qt/gen_qlockfile.cpp

63 lines
1.3 KiB
C++
Raw Permalink 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"
#ifndef _Bool
#define _Bool bool
#endif
#include "_cgo_export.h"
2024-12-07 04:15:57 +00:00
QLockFile* QLockFile_new(struct miqt_string fileName) {
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
2024-12-07 04:15:57 +00:00
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(const QLockFile* self) {
return self->staleLockTime();
}
bool QLockFile_IsLocked(const QLockFile* self) {
return self->isLocked();
}
bool QLockFile_RemoveStaleLockFile(QLockFile* self) {
return self->removeStaleLockFile();
}
int QLockFile_Error(const QLockFile* self) {
QLockFile::LockError _ret = self->error();
return static_cast<int>(_ret);
2024-08-29 07:01:51 +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;
}
}