15 : TQMemArray<KMMsgBase*>(initSize),
16 mHigh( 0 ), mCount( 0 )
19 for (
unsigned int i=size(); i>0; i--)
20 TQMemArray<KMMsgBase*>::at(i-1) = 0;
35 for (
unsigned int i=mHigh; i>0; i--)
37 KMMsgBase * msg = at(i-1);
40 KMMsgDict::mutableInstance()->remove(msg);
42 if (doDelete)
delete msg;
53 unsigned int i, oldSize = size();
59 for (i=aSize; i<mHigh; i++)
72 if (!TQMemArray<KMMsgBase*>::resize(aSize))
return FALSE;
75 for (i=oldSize; i<aSize; i++)
85 if (!
resize(aSize))
return FALSE;
95 resize( idx > 2 * size() ? idx + 16 : 2 * size() );
97 if (!at(idx) && aMsg) mCount++;
98 else if (at(idx) && !aMsg) mCount--;
110 resize( idx > 2 * size() ? idx + 16 : 2 * size() );
114 for (
unsigned int i=mHigh; i>idx; i--) {
116 KMMsgDict::mutableInstance()->remove(at(i - 1));
119 KMMsgDict::mutableInstance()->insert(at(i), i);
124 KMMsgDict::mutableInstance()->insert(at(idx), idx);
133 const unsigned int idx = mHigh;
134 insert(idx, aMsg, syncDict);
145 KMMsgDict::mutableInstance()->remove(at(idx));
149 for (
unsigned int i=idx; i<mHigh; i++) {
150 KMMsgDict::mutableInstance()->update(at(i + 1), i + 1, i);
163 KMMsgBase* msg=at(idx);
172 unsigned int sz = size();
174 if (mHigh < sz && at(mHigh))
177 while (mHigh < sz && at(mHigh))
183 while (mHigh>0 && !at(mHigh-1))
void insert(unsigned int idx, KMMsgBase *msg, bool syncDict=true)
Insert message at given index.
KMMsgBase * take(unsigned int idx)
Returns message at given index and removes it from the list.
unsigned int append(KMMsgBase *msg, bool syncDict=true)
Append given message after the last used message.
~KMMsgList()
Destructor also deletes all messages in the list.
bool reset(unsigned int size)
Clear the array and resize it to given size.
void remove(unsigned int idx)
Remove message at given index without deleting it.
KMMsgList(int initialSize=32)
Constructor with optional initial size.
void rethinkHigh()
Set mHigh to proper value.
bool resize(unsigned int size)
Resize array and initialize new elements if any.
void clear(bool autoDelete=TRUE, bool syncDict=false)
Clear messages.
void set(unsigned int idx, KMMsgBase *msg)
Set message at given index.