xref: /haiku/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.h (revision e0ef64750f3169cd634bb2f7a001e22488b05231)
1 /*
2  * Copyright 2010, Haiku Inc. All rights reserved.
3  * This file may be used under the terms of the MIT License.
4  *
5  * Authors:
6  *		Janito V. Ferreira Filho
7  */
8 #ifndef HTREE_ENTRY_ITERATOR_H
9 #define HTREE_ENTRY_ITERATOR_H
10 
11 
12 #include <AutoDeleter.h>
13 
14 #include "DirectoryIterator.h"
15 
16 
17 class HTreeEntryIterator {
18 public:
19 								HTreeEntryIterator(off_t offset,
20 									Inode* directory);
21 								~HTreeEntryIterator();
22 
23 			status_t			Init();
24 
25 			status_t			Lookup(uint32 hash, int indirections,
26 									DirectoryIterator**	iterator);
27 			bool				HasCollision() { return fHasCollision; }
28 
29 			status_t			GetNext(off_t& offset);
30 private:
31 								HTreeEntryIterator(uint32 block,
32 									uint32 blockSize, Inode* directory,
33 									HTreeEntryIterator* parent,
34 									bool hasCollision);
35 
36 private:
37 			bool				fHasCollision;
38 			uint16				fLimit, fCount;
39 
40 			uint32				fBlockSize;
41 			Inode*				fDirectory;
42 			off_t				fOffset;
43 			off_t				fMaxOffset;
44 
45 			HTreeEntryIterator*	fParent;
46 			HTreeEntryIterator*	fChild;
47 			ObjectDeleter<HTreeEntryIterator> fChildDeleter;
48 };
49 
50 #endif	// HTREE_ENTRY_ITERATOR_H
51