kmail
KMFolderIndex Class Reference
A FolderStorage with an index for faster access to often used message properties. More...
#include <kmfolderindex.h>

Public Types | |
enum | IndexStatus { IndexOk, IndexMissing, IndexCorrupt, IndexTooOld } |
Public Slots | |
virtual int | updateIndex () |
Public Member Functions | |
KMFolderIndex (KMFolder *folder, const char *name=0) | |
virtual int | count (bool cache=false) const |
virtual KMMsgBase * | takeIndexEntry (int idx) |
virtual KMMsgInfo * | setIndexEntry (int idx, KMMessage *msg) |
virtual void | clearIndex (bool autoDelete=true, bool syncDict=false) |
virtual void | truncateIndex () |
virtual const KMMsgBase * | getMsgBase (int idx) const |
virtual KMMsgBase * | getMsgBase (int idx) |
virtual int | find (const KMMsgBase *msg) const |
int | find (const KMMessage *msg) const |
int | serialIndexId () const |
uchar * | indexStreamBasePtr () |
bool | indexSwapByteOrder () |
int | indexSizeOfLong () |
virtual TQString | indexLocation () const |
virtual int | writeIndex (bool createEmptyIndex=false) |
void | recreateIndex (bool readIndexAfterwards=true) |
void | silentlyRecreateIndex () |
virtual IndexStatus | indexStatus ()=0 |
Protected Member Functions | |
bool | readIndex () |
bool | readIndexHeader (int *gv=0) |
virtual int | createIndexFromContents ()=0 |
bool | updateIndexStreamPtr (bool just_close=FALSE) |
virtual void | fillMessageDict () |
Protected Attributes | |
FILE * | mIndexStream |
KMMsgList | mMsgList |
off_t | mHeaderOffset |
uchar * | mIndexStreamPtr |
int | mIndexStreamPtrLength |
int | mIndexId |
bool | mIndexSwapByteOrder |
int | mIndexSizeOfLong |
Friends | |
class | ::KMMsgBase |
Detailed Description
A FolderStorage with an index for faster access to often used message properties.
This class represents a message store which has an index for providing fast access to often used message properties, namely those displayed in the list of messages (KMHeaders).
Definition at line 37 of file kmfolderindex.h.
Member Enumeration Documentation
This enum indicates the status of the index file.
It's returned by indexStatus().
Definition at line 50 of file kmfolderindex.h.
Constructor & Destructor Documentation
KMFolderIndex::KMFolderIndex | ( | KMFolder * | folder, | |
const char * | name = 0 | |||
) |
Usually a parent is given.
But in some cases there is no fitting parent object available. Then the name of the folder is used as the absolute path to the folder file.
Definition at line 77 of file kmfolderindex.cpp.
Member Function Documentation
int KMFolderIndex::count | ( | bool | cache = false |
) | const [virtual] |
Number of messages in this folder.
Reimplemented from FolderStorage.
Definition at line 324 of file kmfolderindex.cpp.
virtual int KMFolderIndex::createIndexFromContents | ( | ) | [protected, pure virtual] |
Create index file from messages file and fill the message-info list mMsgList.
Returns 0 on success and an errno value (see fopen) on failure.
void KMFolderIndex::fillMessageDict | ( | ) | [protected, virtual] |
Inserts messages into the message dictionary by iterating over the message list.
The messages will get new serial numbers. This is only used on newly appeared folders, where there is no .ids file yet, or when that has been invalidated.
Reimplemented from FolderStorage.
Definition at line 502 of file kmfolderindex.cpp.
virtual int KMFolderIndex::find | ( | const KMMsgBase * | msg | ) | const [inline, virtual] |
Returns the index of the given message or -1 if not found.
Implements FolderStorage.
Definition at line 71 of file kmfolderindex.h.
virtual const KMMsgBase* KMFolderIndex::getMsgBase | ( | int | idx | ) | const [inline, virtual] |
Provides access to the basic message fields that are also stored in the index.
Whenever you only need subject, from, date, status you should use this method instead of getMsg() because getMsg() will load the message if necessary and this method does not.
Implements FolderStorage.
Definition at line 68 of file kmfolderindex.h.
TQString KMFolderIndex::indexLocation | ( | ) | const [virtual] |
Returns full path to index file.
Implements FolderStorage.
Definition at line 95 of file kmfolderindex.cpp.
KMFolderIndex::IndexStatus KMFolderIndex::indexStatus | ( | ) | [pure virtual] |
Tests whether the contents of this folder is newer than the index.
Should return IndexTooOld if the index is older than the contents. Should return IndexMissing if there is contents but no index. Should return IndexOk if the folder doesn't exist anymore "physically" or if the index is not older than the contents.
Definition at line 470 of file kmfolderindex.cpp.
bool KMFolderIndex::readIndex | ( | ) | [protected, virtual] |
Read index file and fill the message-info list mMsgList.
Implements FolderStorage.
Definition at line 218 of file kmfolderindex.cpp.
bool KMFolderIndex::readIndexHeader | ( | int * | gv = 0 |
) | [protected] |
Read index header.
Called from within readIndex().
Definition at line 333 of file kmfolderindex.cpp.
int KMFolderIndex::serialIndexId | ( | ) | const [inline] |
Registered unique serial number for the index file.
Definition at line 75 of file kmfolderindex.h.
int KMFolderIndex::updateIndex | ( | ) | [virtual, slot] |
Incrementally update the index if possible else call writeIndex.
Implements FolderStorage.
Definition at line 109 of file kmfolderindex.cpp.
int KMFolderIndex::writeIndex | ( | bool | createEmptyIndex = false |
) | [virtual] |
Write index to index-file.
Returns 0 on success and errno error on failure.
Implements FolderStorage.
Definition at line 129 of file kmfolderindex.cpp.
Member Data Documentation
off_t KMFolderIndex::mHeaderOffset [protected] |
offset of header of index file
Definition at line 125 of file kmfolderindex.h.
FILE* KMFolderIndex::mIndexStream [protected] |
table of contents file
Definition at line 120 of file kmfolderindex.h.
KMMsgList KMFolderIndex::mMsgList [protected] |
list of index entries or messages
Definition at line 122 of file kmfolderindex.h.
The documentation for this class was generated from the following files: