KWQValueListImpl.h [plain text]
#ifndef KWQVALUELIST_H_
#define KWQVALUELIST_H_
#include "KWQRefPtr.h"
#include "KWQDef.h"
class KWQValueListNodeImpl;
class KWQValueListIteratorImpl
{
public:
KWQValueListIteratorImpl();
bool operator==(const KWQValueListIteratorImpl &other);
bool operator!=(const KWQValueListIteratorImpl &other);
KWQValueListNodeImpl *node();
const KWQValueListNodeImpl *node() const;
KWQValueListIteratorImpl& operator++();
KWQValueListIteratorImpl operator++(int);
KWQValueListIteratorImpl& operator--();
private:
KWQValueListIteratorImpl(const KWQValueListNodeImpl *n);
KWQValueListNodeImpl *nodeImpl;
friend class KWQValueListImpl;
};
class KWQValueListImpl
{
public:
KWQValueListImpl(void (*deleteFunc)(KWQValueListNodeImpl *), KWQValueListNodeImpl *(*copyNode)(KWQValueListNodeImpl *));
~KWQValueListImpl();
KWQValueListImpl(const KWQValueListImpl&);
KWQValueListImpl& operator=(const KWQValueListImpl&);
void clear();
uint count() const;
bool isEmpty() const;
KWQValueListIteratorImpl appendNode(KWQValueListNodeImpl *node);
KWQValueListIteratorImpl prependNode(KWQValueListNodeImpl *node);
void removeEqualNodes(KWQValueListNodeImpl *node, bool (*equalFunc)(const KWQValueListNodeImpl *, const KWQValueListNodeImpl *));
uint containsEqualNodes(KWQValueListNodeImpl *node, bool (*equalFunc)(const KWQValueListNodeImpl *, const KWQValueListNodeImpl *)) const;
KWQValueListIteratorImpl removeIterator(KWQValueListIteratorImpl &iterator);
KWQValueListIteratorImpl fromLast();
KWQValueListNodeImpl *firstNode();
KWQValueListNodeImpl *lastNode();
KWQValueListNodeImpl *firstNode() const;
KWQValueListNodeImpl *lastNode() const;
KWQValueListIteratorImpl begin();
KWQValueListIteratorImpl end();
KWQValueListIteratorImpl begin() const;
KWQValueListIteratorImpl end() const;
KWQValueListNodeImpl *nodeAt(uint index);
KWQValueListNodeImpl *nodeAt(uint index) const;
bool isEqual(const KWQValueListImpl &other, bool (*equalFunc)(const KWQValueListNodeImpl *, const KWQValueListNodeImpl *)) const;
private:
void copyOnWrite();
class KWQValueListPrivate;
KWQRefPtr<KWQValueListPrivate> d;
friend class KWQValueListNodeImpl;
};
class KWQValueListNodeImpl
{
protected:
KWQValueListNodeImpl();
private:
KWQValueListNodeImpl *prev;
KWQValueListNodeImpl *next;
friend class KWQValueListImpl;
friend class KWQValueListIteratorImpl;
friend class KWQValueListImpl::KWQValueListPrivate;
};
#endif