1/*
2 * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * All rights reserved. Distributed under the terms of the MIT license.
4 */
5#ifndef ATTRIBUTE_ITERATOR_H
6#define ATTRIBUTE_ITERATOR_H
7
8#include <SupportDefs.h>
9
10#include <util/DoublyLinkedList.h>
11
12
13class Attribute;
14class Node;
15
16class AttributeIterator : public DoublyLinkedListLinkImpl<AttributeIterator> {
17public:
18	AttributeIterator(Node *node = NULL);
19	~AttributeIterator();
20
21	status_t SetTo(Node *node);
22	void Unset();
23
24	Node *GetNode() const { return fNode; }
25
26	status_t Suspend();
27	status_t Resume();
28	bool IsSuspended() const { return fSuspended; }
29
30	status_t GetNext(Attribute **attribute);
31	Attribute *GetCurrent() const { return fAttribute; }
32
33	status_t Rewind();
34
35private:
36	void SetCurrent(Attribute *attribute, bool isNext);
37
38private:
39	friend class Node;
40
41private:
42	Node							*fNode;
43	Attribute						*fAttribute;
44	bool							fSuspended;
45	bool							fIsNext;
46	bool							fDone;
47};
48
49#endif	// ATTRIBUTE_ITERATOR_H
50