xref: /haiku/src/apps/text_search/FileIterator.h (revision b671e9bbdbd10268a042b4f4cc4317ccd03d105e)
1 /*
2  * Copyright (c) 2008 Stephan Aßmus <superstippi@gmx.de>
3  * Copyright (c) 1998-2007 Matthijs Hollemans
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 #ifndef FILE_ITERATOR_H
24 #define FILE_ITERATOR_H
25 
26 class BEntry;
27 
28 // Provides an interface to retrieve the next file that should be grepped
29 // for the search string.
30 class FileIterator {
31 public:
32 								FileIterator();
33 	virtual						~FileIterator();
34 
35 	virtual	bool				IsValid() const = 0;
36 
37 	// Returns the full path name of the next file.
38 	virtual	bool				GetNextName(char* buffer) = 0;
39 
40 	// Tells the Grepper whether the targets wants to know about negative hits.
41 	virtual	bool				NotifyNegatives() const = 0;
42 
43 protected:
44 	// Determines whether we can grep a file.
45 			bool				_ExamineFile(BEntry& entry, char* buffer,
46 									bool textFilesOnly);
47 };
48 
49 #endif // FILE_ITERATOR_H
50