#include <kmmsglist.h>
Inherits TQMemArray< T >.
Public Member Functions | |
KMMsgList (int initialSize=32) | |
~KMMsgList () | |
void | remove (unsigned int idx) |
KMMsgBase * | take (unsigned int idx) |
void | insert (unsigned int idx, KMMsgBase *msg, bool syncDict=true) |
unsigned int | append (KMMsgBase *msg, bool syncDict=true) |
void | clear (bool autoDelete=TRUE, bool syncDict=false) |
bool | resize (unsigned int size) |
bool | reset (unsigned int size) |
void | set (unsigned int idx, KMMsgBase *msg) |
unsigned int | high () const |
unsigned int | count () const |
Protected Member Functions | |
void | rethinkHigh () |
Protected Attributes | |
unsigned int | mHigh |
unsigned int | mCount |
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.
Definition at line 37 of file kmmsglist.h.
Constructor & Destructor Documentation
◆ KMMsgList()
KMMsgList::KMMsgList | ( | int | initialSize = 32 | ) |
Constructor with optional initial size.
Definition at line 14 of file kmmsglist.cpp.
◆ ~KMMsgList()
KMMsgList::~KMMsgList | ( | ) |
Destructor also deletes all messages in the list.
Definition at line 25 of file kmmsglist.cpp.
Member Function Documentation
◆ append()
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.
◆ clear()
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.
◆ count()
|
inline |
Number of messages in the array.
Definition at line 86 of file kmmsglist.h.
◆ high()
|
inline |
Returns first unused index (index of last message plus one).
Definition at line 83 of file kmmsglist.h.
◆ insert()
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.
◆ remove()
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.
◆ reset()
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.
◆ resize()
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.
◆ rethinkHigh()
|
protected |
Set mHigh to proper value.
Definition at line 170 of file kmmsglist.cpp.
◆ set()
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.
◆ take()
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
◆ mCount
|
protected |
Definition at line 92 of file kmmsglist.h.
◆ mHigh
|
protected |
Definition at line 92 of file kmmsglist.h.
The documentation for this class was generated from the following files: