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