kget
bt::CacheFile Class Reference
#include <cachefile.h>
Inheritance diagram for bt::CacheFile:

Detailed Description
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 |
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 | ) |
| 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 | ( | ) |
| 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.
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 | ) |
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.
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:
KDE 4.2 API Reference