Public Member Functions | Private Attributes | List of all members
FileStorage Class Reference

Store implementation based on a file. Writing is linear, after that the file is re-opened for reading. Reading is random (seek+read). More...

#include <filestorage.h>

Inheritance diagram for FileStorage:
StorageIntf

Public Member Functions

 FileStorage ()
 
 FileStorage (const QString &name)
 
int read (char *buf, uint size)
 
int write (const char *buf, uint size)
 
bool open (int m)
 
bool seek (int64 pos)
 
int64 pos () const
 
void close ()
 
void setName (const char *name)
 
- Public Member Functions inherited from StorageIntf
virtual ~StorageIntf ()
 

Private Attributes

bool m_readOnly
 
QFile m_file
 

Detailed Description

Store implementation based on a file. Writing is linear, after that the file is re-opened for reading. Reading is random (seek+read).

Definition at line 28 of file filestorage.h.

Constructor & Destructor Documentation

FileStorage::FileStorage ( )
inline

Definition at line 31 of file filestorage.h.

31 : m_readOnly(FALSE) {}
const bool FALSE
Definition: qglobal.h:370
bool m_readOnly
Definition: filestorage.h:42
FileStorage::FileStorage ( const QString name)
inline

Definition at line 32 of file filestorage.h.

32  :
33  m_readOnly(FALSE) { m_file.setName(name); }
QFile m_file
Definition: filestorage.h:43
const bool FALSE
Definition: qglobal.h:370
bool m_readOnly
Definition: filestorage.h:42
void setName(const QString &name)
Definition: qfile.cpp:167

Member Function Documentation

void FileStorage::close ( )
inline

Definition at line 39 of file filestorage.h.

39 { m_file.close(); }
QFile m_file
Definition: filestorage.h:43
void close()
Definition: qfile_unix.cpp:614
bool FileStorage::open ( int  m)
inline

Definition at line 36 of file filestorage.h.

36 { m_readOnly = m==IO_ReadOnly; return m_file.open(m); }
QFile m_file
Definition: filestorage.h:43
bool m_readOnly
Definition: filestorage.h:42
#define IO_ReadOnly
Definition: qiodevice.h:61
bool open(int)
Definition: qfile_unix.cpp:134
int64 FileStorage::pos ( ) const
inline

Definition at line 38 of file filestorage.h.

38 { return m_file.pos(); }
QFile m_file
Definition: filestorage.h:43
int64 pos() const
Definition: qfile_unix.cpp:637
int FileStorage::read ( char *  buf,
uint  size 
)
inlinevirtual

Read size bytes from the store into buf.

Implements StorageIntf.

Definition at line 34 of file filestorage.h.

34 { return m_file.readBlock(buf,size); }
QFile m_file
Definition: filestorage.h:43
int readBlock(char *data, uint len)
Definition: qfile_unix.cpp:473
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
bool FileStorage::seek ( int64  pos)
inline

Definition at line 37 of file filestorage.h.

37 { return m_file.seek(pos); }
QFile m_file
Definition: filestorage.h:43
bool seek(int64 pos)
Definition: qfile_unix.cpp:660
int64 pos() const
Definition: filestorage.h:38
void FileStorage::setName ( const char *  name)
inline

Definition at line 40 of file filestorage.h.

40 { m_file.setName(name); }
static QCString name
Definition: declinfo.cpp:673
QFile m_file
Definition: filestorage.h:43
void setName(const QString &name)
Definition: qfile.cpp:167
int FileStorage::write ( const char *  buf,
uint  size 
)
inlinevirtual

Write size bytes from buf into the store.

Implements StorageIntf.

Definition at line 35 of file filestorage.h.

35 { assert(m_readOnly==FALSE); return m_file.writeBlock(buf,size); }
QFile m_file
Definition: filestorage.h:43
const bool FALSE
Definition: qglobal.h:370
bool m_readOnly
Definition: filestorage.h:42
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
int writeBlock(const char *data, uint len)
Definition: qfile_unix.cpp:537

Member Data Documentation

QFile FileStorage::m_file
private

Definition at line 43 of file filestorage.h.

bool FileStorage::m_readOnly
private

Definition at line 42 of file filestorage.h.


The documentation for this class was generated from the following file: