2 * Copyright (c) 2008 Stephan Aßmus <superstippi@gmx.de>
3 * Copyright (c) 1998-2007 Matthijs Hollemans
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:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
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.
23 #ifndef INITIAL_ITERATOR_H
24 #define INITIAL_ITERATOR_H
29 #include "FileIterator.h"
35 // TODO: split into Folder and MessageFileIterator (_GetTopEntry)
36 // This code either has an original folder to start iterating from,
37 // or it uses the refs in the message that contains the selected poses
38 // from the Tracker window that invoked us. But I think if folders are
39 // among those poses, it will then use the same code for examining sub
42 // Provides an interface to retrieve the next file that should be grepped
43 // for the search string.
44 class InitialIterator
: public FileIterator
{
46 InitialIterator(const Model
* model
);
47 virtual ~InitialIterator();
49 virtual bool IsValid() const;
50 virtual bool GetNextName(char* buffer
);
51 virtual bool NotifyNegatives() const;
53 // Looks for the next entry in the top-level dir.
54 bool GetTopEntry(BEntry
& entry
);
56 // Should this subfolder be followed?
57 bool FollowSubdir(BEntry
& entry
) const;
60 // Looks for the next entry.
61 bool _GetNextEntry(BEntry
& entry
);
63 // Looks for the next entry in a subdir.
64 bool _GetSubEntry(BEntry
& entry
);
66 // Determines whether we can add a subdir.
67 void _ExamineSubdir(BEntry
& entry
);
70 // Contains pointers to BDirectory objects.
73 // The directory we are currently looking at.
74 BDirectory
* fCurrentDir
;
76 // The ref number we are currently looking at.
79 // The current settings
80 BMessage fSelectedFiles
;
82 bool fRecurseDirs
: 1;
83 bool fRecurseLinks
: 1;
84 bool fSkipDotDirs
: 1;
88 #endif // INITIAL_ITERATOR_H