• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kget

bt::CacheFile

bt::CacheFile Class Reference

#include <cachefile.h>

Inheritance diagram for bt::CacheFile:

Inheritance graph
[legend]

List of all members.


Detailed Description

Author:
Joris Guisson <joris.guisson@gmail.com>

Used by Single and MultiFileCache to write to disk.

Definition at line 54 of file cachefile.h.


Public Types

enum  Mode { READ, WRITE, RW }

Public Member Functions

 CacheFile ()
void changePath (const QString &npath)
void close ()
Uint64 diskUsage ()
void * map (MMappeable *thing, Uint64 off, Uint32 size, Mode mode)
void open (const QString &path, Uint64 size)
void preallocate (PreallocationThread *prealloc)
void read (Uint8 *buf, Uint32 size, Uint64 off)
void unmap (void *ptr, Uint32 size)
void write (const Uint8 *buf, Uint32 size, Uint64 off)
virtual ~CacheFile ()

Member Enumeration Documentation

enum bt::CacheFile::Mode

Enumerator:
READ 
WRITE 
RW 

Definition at line 61 of file cachefile.h.


Constructor & Destructor Documentation

bt::CacheFile::CacheFile (  ) 

Definition at line 59 of file cachefile.cpp.

bt::CacheFile::~CacheFile (  )  [virtual]

Definition at line 66 of file cachefile.cpp.


Member Function Documentation

void bt::CacheFile::changePath ( const QString &  npath  ) 

Change the path of the file.

Definition at line 72 of file cachefile.cpp.

void bt::CacheFile::close (  ) 

Close the file, everything will be unmapped.

Parameters:
to_be_reopened Indicates if the close is temporarely (i.e. it will be reopened)

Definition at line 366 of file cachefile.cpp.

Uint64 bt::CacheFile::diskUsage (  ) 

Get the number of bytes this cache file is taking up.

Definition at line 534 of file cachefile.cpp.

void * bt::CacheFile::map ( MMappeable *  thing,
Uint64  off,
Uint32  size,
Mode  mode 
)

Map a part of the file into memory, will expand the file if it is to small, but will not go past the limit set in open.

Parameters:
thing The thing that wishes to map the mmapping
off Offset into the file
size Size of the region to map
mode How the region will be mapped
Returns:
A ptr to the mmaped region, or 0 if something goes wrong

Definition at line 110 of file cachefile.cpp.

void bt::CacheFile::open ( const QString &  path,
Uint64  size 
)

Open the file.

Parameters:
path Path of the file
size Max size of the file
Exceptions:
Error when something goes wrong

Definition at line 102 of file cachefile.cpp.

void bt::CacheFile::preallocate ( PreallocationThread *  prealloc  ) 

Preallocate disk space.

Definition at line 472 of file cachefile.cpp.

void bt::CacheFile::read ( Uint8 *  buf,
Uint32  size,
Uint64  off 
)

Read from the file.

Parameters:
buf Buffer to store data
size Size to read
off Offset to read from in file

Definition at line 381 of file cachefile.cpp.

void bt::CacheFile::unmap ( void *  ptr,
Uint32  size 
)

Unmap a previously mapped region.

Parameters:
ptr Ptr to the region
size Size of the region

Definition at line 258 of file cachefile.cpp.

void bt::CacheFile::write ( const Uint8 *  buf,
Uint32  size,
Uint64  off 
)

Write to the file.

Parameters:
buf Buffer to write
size Size to read
off Offset to read from in file

Definition at line 416 of file cachefile.cpp.


The documentation for this class was generated from the following files:
  • cachefile.h
  • cachefile.cpp

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal