xref: /haiku/src/add-ons/kernel/file_systems/ramfs/AttributeIterator.h (revision b55a57da7173b9af0432bd3e148d03f06161d036)
1 // AttributeIterator.h
2 
3 #ifndef ATTRIBUTE_ITERATOR_H
4 #define ATTRIBUTE_ITERATOR_H
5 
6 #include <SupportDefs.h>
7 
8 #include <util/DoublyLinkedList.h>
9 
10 
11 class Attribute;
12 class Node;
13 
14 class AttributeIterator : public DoublyLinkedListLinkImpl<AttributeIterator> {
15 public:
16 	AttributeIterator(Node *node = NULL);
17 	~AttributeIterator();
18 
19 	status_t SetTo(Node *node);
20 	void Unset();
21 
22 	Node *GetNode() const { return fNode; }
23 
24 	status_t Suspend();
25 	status_t Resume();
26 	bool IsSuspended() const { return fSuspended; }
27 
28 	status_t GetNext(Attribute **attribute);
29 	Attribute *GetCurrent() const { return fAttribute; }
30 
31 	status_t Rewind();
32 
33 private:
34 	void SetCurrent(Attribute *attribute, bool isNext);
35 
36 private:
37 	friend class Node;
38 
39 private:
40 	Node							*fNode;
41 	Attribute						*fAttribute;
42 	bool							fSuspended;
43 	bool							fIsNext;
44 	bool							fDone;
45 };
46 
47 #endif	// ATTRIBUTE_ITERATOR_H
48