My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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.

: m_readOnly(FALSE) {}
FileStorage::FileStorage ( const QString &  name)
inline

Definition at line 32 of file filestorage.h.

References m_file.

:
m_readOnly(FALSE) { m_file.setName(name); }

Member Function Documentation

void FileStorage::close ( )
inline

Definition at line 39 of file filestorage.h.

References m_file.

Referenced by parseInput().

{ m_file.close(); }
bool FileStorage::open ( int  m)
inline

Definition at line 36 of file filestorage.h.

References m_file, and m_readOnly.

Referenced by parseInput().

{ m_readOnly = m==IO_ReadOnly; return m_file.open(m); }
int64 FileStorage::pos ( ) const
inline

Definition at line 38 of file filestorage.h.

References m_file.

Referenced by EntryNav::saveEntry().

{ return m_file.pos(); }
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.

References m_file.

{ return m_file.readBlock(buf,size); }
bool FileStorage::seek ( int64  pos)
inline

Definition at line 37 of file filestorage.h.

References m_file.

Referenced by EntryNav::loadEntry().

{ return m_file.seek(pos); }
void FileStorage::setName ( const char *  name)
inline

Definition at line 40 of file filestorage.h.

References m_file.

Referenced by parseInput().

{ m_file.setName(name); }
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.

References m_file, and m_readOnly.

{ assert(m_readOnly==FALSE); return m_file.writeBlock(buf,size); }

Member Data Documentation

QFile FileStorage::m_file
private

Definition at line 43 of file filestorage.h.

Referenced by close(), FileStorage(), open(), pos(), read(), seek(), setName(), and write().

bool FileStorage::m_readOnly
private

Definition at line 42 of file filestorage.h.

Referenced by open(), and write().


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