kmail

KMMsgList Class Reference

An abstraction of an array of pointers to messages. More...

#include <kmmsglist.h>

Inheritance diagram for KMMsgList:

List of all members.


Public Member Functions

unsigned int append (KMMsgBase *msg, bool syncDict=true)
void clear (bool autoDelete=TRUE, bool syncDict=false)
unsigned int count () const
unsigned int high () const
void insert (unsigned int idx, KMMsgBase *msg, bool syncDict=true)
 KMMsgList (int initialSize=32)
void remove (unsigned int idx)
bool reset (unsigned int size)
bool resize (unsigned int size)
void set (unsigned int idx, KMMsgBase *msg)
KMMsgBasetake (unsigned int idx)
 ~KMMsgList ()

Protected Member Functions

void rethinkHigh ()

Protected Attributes

unsigned int mCount
unsigned int mHigh

Detailed Description

An abstraction of an array of pointers to messages.

This class represents an array of pointers to message objects. It autoresizes and can load a KMMsgDict object from its contents. It's a pure implementation detail of KMFolderIndex and should not be used by the layers above that.

Author:
Stefan Taferner <taferner@kde.org>

Definition at line 37 of file kmmsglist.h.


Constructor & Destructor Documentation

KMMsgList::KMMsgList ( int  initialSize = 32  ) 

Constructor with optional initial size.

Definition at line 14 of file kmmsglist.cpp.

KMMsgList::~KMMsgList (  ) 

Destructor also deletes all messages in the list.

Definition at line 25 of file kmmsglist.cpp.


Member Function Documentation

unsigned int KMMsgList::append ( KMMsgBase msg,
bool  syncDict = true 
)

Append given message after the last used message.

Resizes the array if necessary. Returns index of new position. If syncDict, also updates message dictionary.

Definition at line 131 of file kmmsglist.cpp.

void KMMsgList::clear ( bool  autoDelete = TRUE,
bool  syncDict = false 
)

Clear messages.

If autoDelete is set (default) the messages are deleted. The array is not resized. If syncDict, also updates the message dictionary.

Definition at line 32 of file kmmsglist.cpp.

unsigned int KMMsgList::count (  )  const [inline]

Number of messages in the array.

Reimplemented from QMemArray< KMMsgBase * >.

Definition at line 86 of file kmmsglist.h.

unsigned int KMMsgList::high (  )  const [inline]

Returns first unused index (index of last message plus one).

Definition at line 83 of file kmmsglist.h.

void KMMsgList::insert ( unsigned int  idx,
KMMsgBase msg,
bool  syncDict = true 
)

Insert message at given index.

Resizes the array if necessary. If syncDict, also updates message dictionary.

Definition at line 107 of file kmmsglist.cpp.

void KMMsgList::remove ( unsigned int  idx  ) 

Remove message at given index without deleting it.

Also removes from message dictionary.

Definition at line 140 of file kmmsglist.cpp.

bool KMMsgList::reset ( unsigned int  size  ) 

Clear the array and resize it to given size.

Returns FALSE if memory cannot be allocated.

Definition at line 83 of file kmmsglist.cpp.

bool KMMsgList::resize ( unsigned int  size  ) 

Resize array and initialize new elements if any.

Returns FALSE if memory cannot be allocated.

Definition at line 51 of file kmmsglist.cpp.

void KMMsgList::rethinkHigh (  )  [protected]

Set mHigh to proper value.

Definition at line 170 of file kmmsglist.cpp.

void KMMsgList::set ( unsigned int  idx,
KMMsgBase msg 
)

Set message at given index.

The array is resized if necessary. If there is already a message at the given index this message is *not* deleted. Does not sync the message dictionary.

Definition at line 92 of file kmmsglist.cpp.

KMMsgBase * KMMsgList::take ( unsigned int  idx  ) 

Returns message at given index and removes it from the list.

Also removes from message dictionary.

Definition at line 161 of file kmmsglist.cpp.


Member Data Documentation

unsigned int KMMsgList::mCount [protected]

Definition at line 92 of file kmmsglist.h.

unsigned int KMMsgList::mHigh [protected]

Definition at line 92 of file kmmsglist.h.


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