xref: /haiku/src/add-ons/kernel/file_systems/netfs/server/Directory.h (revision 95c9effd68127df2dce202d5e254a7c86560010a)
1 // Directory.h
2 
3 #ifndef NET_FS_DIRECTORY_H
4 #define NET_FS_DIRECTORY_H
5 
6 #include <util/DoublyLinkedList.h>
7 
8 #include "Node.h"
9 #include "NodeHandle.h"
10 
11 // Directory
12 class Directory : public Node {
13 public:
14 								Directory(Volume* volume,
15 									const struct stat& st);
16 	virtual						~Directory();
17 
18 	virtual	Entry*				GetActualReferringEntry() const;
19 
20 			void				AddEntry(Entry* entry);
21 			void				RemoveEntry(Entry* entry);
22 			Entry*				GetFirstEntry() const;
23 			Entry*				GetNextEntry(Entry* entry) const;
24 			int32				CountEntries() const;
25 									// WARNING: O(n)! Use for debugging only!
26 
27 			status_t			OpenDir(DirIterator** iterator);
28 
29 			bool				HasDirIterators() const;
30 			void				RemoveDirIterator(DirIterator* iterator);
31 
32 			void				SetComplete(bool complete);
33 			bool				IsComplete() const;
34 
35 private:
36 			typedef DoublyLinkedList<Entry, Entry::GetDirEntryLink> EntryList;
37 			typedef DoublyLinkedList<DirIterator> IteratorList;
38 
39 			EntryList			fEntries;
40 			IteratorList		fIterators;
41 			bool				fIsComplete;
42 };
43 
44 
45 #endif	// NET_FS_DIRECTORY_H
46