Home

qtlockedfile.h

This is the verbatim text of the qtlockedfile.h include file. It is provided only for illustration; the copyright remains with Trolltech.


#ifndef QTLOCKEDFILE_H
#define QTLOCKEDFILE_H

#include <qnamespace.h>
#include <qfile.h>

class QtLockedFile : public QFile
{
public:
    enum LockMode { NoLock = 0, ReadLock, WriteLock };

    QtLockedFile();
    QtLockedFile(const QString &name);
    ~QtLockedFile();

    bool lock(LockMode mode, bool block = true);
    bool unlock();
    bool isLocked() const;
    LockMode lockMode() const;

private:
#ifdef Q_OS_WIN
    Qt::HANDLE m_semaphore_hnd;
    Qt::HANDLE m_mutex_hnd;
#endif
    LockMode m_lock_mode;
};

#endif

Copyright © 2003-2006 TrolltechTrademarks
Qt Solutions