* (C) 1998 by Karsten Ballüder (Ballueder@usa.net) *
* *
* $Id$
- * $Log$
- * Revision 1.1 1998/06/29 12:44:36 KB
- * Added my wxWindows based layout engine to the repository.
- * It arranges text and graphics for display on a wxDC.
- * This code is licensed under the LGPL.
- *
- * Revision 1.6 1998/06/27 20:06:10 KB
- * Added my layout code.
*
*******************************************************************/
@param inext if not NULL, use this as next element in list
*/
kbListNode( void *ielement,
- kbListNode *iprev = NULL,
- kbListNode *inext = NULL);
+ kbListNode *iprev = (kbListNode *) NULL,
+ kbListNode *inext = (kbListNode *) NULL);
/// Destructor.
~kbListNode();
};
/** Constructor.
@param n if not NULL, the node to which to point
*/
- iterator(kbListNode *n = NULL);
+ iterator(kbListNode *n = (kbListNode *) NULL);
/** Dereference operator.
@return the data pointer of the node belonging to this
iterator
bool empty(void) const
{ return first == NULL ; }
-private:
+protected:
/// if true, list owns entries
bool ownsEntries;
/// pointer to first element in list
/// pointer to last element in list
kbListNode *last;
+private:
/// forbid copy construction
kbList(kbList const &foo);
/// forbid assignments
{ node = i.Node(); } \
friend class name; \
public: \
- inline iterator(kbListNode *n = NULL) \
+ inline iterator(kbListNode *n = (kbListNode *) NULL) \
: kbList::iterator(n) {} \
inline type * operator*() \
/* the cast is needed for MS VC++ 5.0 */ \
{ return (type *)((kbList::iterator *)this)->operator*() ; } \
}; \
- inline name(bool ownsEntriesFlag = true) \
+ inline name(bool ownsEntriesFlag = FALSE) \
: kbList(ownsEntriesFlag) {} \
\
inline void push_back(type *element) \
inline void insert(iterator & i, type *element) \
{ kbList::insert(i, (void *) element); } \
\
- void erase(iterator & i) \
+ inline void erase(iterator & i) \
{ kbList::erase(i); } \
\
inline iterator begin(void) const \
\
inline iterator tail(void) const \
{ return kbList::tail(); } \
-}
+ ~name() \
+ { \
+ kbListNode *next; \
+ while ( first != (kbListNode *) NULL ) \
+ { \
+ next = first->next; \
+ if(ownsEntries) \
+ delete typecast(first->element); \
+ delete first; \
+ first = next; \
+ } \
+ } \
+ private: \
+ inline type * typecast(void *ptr) \
+ { return (type *) ptr; } \
+ }
#ifdef MCONFIG_H
/// define the most commonly used list type once: