1/* 2 * Copyright (c) 2008 Stephan A��mus <superstippi@gmx.de> 3 * Copyright (c) 1998-2007 Matthijs Hollemans 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6#ifndef INITIAL_ITERATOR_H 7#define INITIAL_ITERATOR_H 8 9#include <List.h> 10#include <Message.h> 11 12#include "FileIterator.h" 13 14class BEntry; 15class BDirectory; 16class Model; 17 18// TODO: split into Folder and MessageFileIterator (_GetTopEntry) 19// This code either has an original folder to start iterating from, 20// or it uses the refs in the message that contains the selected poses 21// from the Tracker window that invoked us. But I think if folders are 22// among those poses, it will then use the same code for examining sub 23// folders. 24 25// Provides an interface to retrieve the next file that should be grepped 26// for the search string. 27class InitialIterator : public FileIterator { 28public: 29 InitialIterator(const Model* model); 30 virtual ~InitialIterator(); 31 32 virtual bool IsValid() const; 33 virtual bool GetNextName(char* buffer); 34 virtual bool NotifyNegatives() const; 35 36 // Looks for the next entry in the top-level dir. 37 bool GetTopEntry(BEntry& entry); 38 39 // Should this subfolder be followed? 40 bool FollowSubdir(BEntry& entry) const; 41 42private: 43 // Looks for the next entry. 44 bool _GetNextEntry(BEntry& entry); 45 46 // Looks for the next entry in a subdir. 47 bool _GetSubEntry(BEntry& entry); 48 49 // Determines whether we can add a subdir. 50 void _ExamineSubdir(BEntry& entry); 51 52private: 53 // Contains pointers to BDirectory objects. 54 BList fDirectories; 55 56 // The directory we are currently looking at. 57 BDirectory* fCurrentDir; 58 59 // The ref number we are currently looking at. 60 int32 fCurrentRef; 61 62 // The current settings 63 BMessage fSelectedFiles; 64 65 bool fRecurseDirs : 1; 66 bool fRecurseLinks : 1; 67 bool fSkipDotDirs : 1; 68 bool fTextOnly : 1; 69}; 70 71#endif // INITIAL_ITERATOR_H 72