xref: /haiku/src/apps/text_search/ChangesIterator.h (revision e81a954787e50e56a7f06f72705b7859b6ab06d1)
1 /*
2  * Copyright (c) 2008 Stephan Aßmus <superstippi@gmx.de>
3  * All rights reserved. Distributed under the terms of the MIT license.
4  */
5 #ifndef CHANGES_ITERATOR_H
6 #define CHANGES_ITERATOR_H
7 
8 #include <HashMap.h>
9 #include <HashString.h>
10 
11 #include "FileIterator.h"
12 
13 class BEntry;
14 class BDirectory;
15 class Model;
16 
17 class ChangesIterator : public FileIterator {
18 public:
19 								ChangesIterator(const Model* model);
20 	virtual						~ChangesIterator();
21 
22 	virtual	bool				IsValid() const;
23 	virtual	bool				GetNextName(char* buffer);
24 	virtual	bool				NotifyNegatives() const;
25 
26 public:
27 			void				EntryAdded(const char* path);
28 			void				EntryRemoved(const char* path);
29 			void				EntryChanged(const char* path);
30 
31 			bool				IsEmpty() const;
32 			void				PrintToStream() const;
33 
34 private:
35 	typedef HashMap<HashString, uint32> PathMap;
36 	enum {
37 		ENTRY_ADDED	= 0,
38 		ENTRY_REMOVED,
39 		ENTRY_CHANGED
40 	};
41 
42 			PathMap				fPathMap;
43 			int32				fIteratorIndex;
44 
45 			bool				fRecurseDirs : 1;
46 			bool				fRecurseLinks : 1;
47 			bool				fSkipDotDirs : 1;
48 			bool				fTextOnly : 1;
49 };
50 
51 #endif // CHANGES_ITERATOR_H
52