xref: /haiku/src/add-ons/kernel/file_systems/ramfs/AttributeIterator.h (revision 1a3518cf757c2da8006753f83962da5935bbc82b)
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 
13 class Attribute;
14 class Node;
15 
16 class AttributeIterator : public DoublyLinkedListLinkImpl<AttributeIterator> {
17 public:
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 
35 private:
36 	void SetCurrent(Attribute *attribute, bool isNext);
37 
38 private:
39 	friend class Node;
40 
41 private:
42 	Node							*fNode;
43 	Attribute						*fAttribute;
44 	bool							fSuspended;
45 	bool							fIsNext;
46 	bool							fDone;
47 };
48 
49 #endif	// ATTRIBUTE_ITERATOR_H
50