📄 directory.h
字号:
*@return bool true if visible to the search */ inline bool getAllowSpecialDirs() const { return allowSpecialDirs_; } inline File& getFileInfo() { return fileInfos_; } inline const File& getFileInfo() const { return fileInfos_; } inline DisplayMode getCurrentDisplayOrder() const { return displayOrderCurrent_; } inline void setCurrentDisplayOrder( const DisplayMode& mode ) { displayOrderCurrent_ = mode; } inline bool canRecurseDown() const { return (-1 == rootSearchFinder_->recursionLevelMax_ || recursionLevel_ < rootSearchFinder_->recursionLevelMax_) ? true : false; } inline void setCurrentElement( File* file ) { currentElement_ = file; searchHasMoreElements_ = ( NULL != currentElement_ ); } void setParentFinder( Finder* finder, const String& relPath, const int& previousRecursionLevel ); void goDownDir( File* file ); void goUpDir( File* file ); void continueSearch( File* file ); public: friend class Directory; protected: // the Finder ctor. Only Directory or its derived can create this object. Finder( Directory* directoryToSearch, FileSearchFilter* filterFileObject = NULL, const bool& ownFilterFileObject = false ); protected: // the File object gathering informations about the file currently retrieved by the search File fileInfos_; /** the directory File owning this finder */ Directory* owningDirectory_; FileSearchFilter* searchFilterFileObject_; bool ownFilterFileObject_; File::FileAttributes maskFilterFileAttribs_; uint32 statMask_; /** The current element retrieved by the search */ File* currentElement_; /** Simply used to know if we have more elements */ bool searchHasMoreElements_; /** The display mode requested by the user */ DisplayMode displayMode_; /** The display order requested by the user */ DisplayMode displayOrder_; /** The display order currently in use */ DisplayMode displayOrderCurrent_; bool allowSpecialDirs_; bool showLocalTime_; bool keepOSSpecificFormat_; /* recursion support */ bool recurse_; /** the relative path to where the search started, while in the current subdirectories */ String relativePathToRootSearch_; /** The followings are pointers to finders used to manage the search along the directory tree. Each finder node has its child and parent finders. For performance and simplicity reasons and in order to avoid useless copying of informations it is convenient to keep a pointer to the active finder representing the search in the current subdirectory. The rootSearchFinder_ is treated differently then the others as it is the finder at the root of the search and the only one always accessible to the user in the search loop. */ /** The main finder. The same finder accessible to the user during all the search loop. */ Finder* rootSearchFinder_; /** pointer to the finder currently active in the search */ Finder* activeFinder_; /** Pointer to finder used to manage the search along the directory tree */ Finder* childFinder_; /** Pointer to finder used to manage the search along the directory tree */ Finder* parentFinder_; /** memory finders' management. This vector is allocated only in the main finder rootSearchFinder_ */ std::vector<Directory*>* subdirs_; std::vector<Finder*>* subfinders_; /** current recursion level */ int recursionLevel_; /** max allowed recursion level */ int recursionLevelMax_; /** for recursion: when we complete the search by dir and we want to search the files or viceversa. */ bool goSearchAgain_; }; // Directory::Finder Directory( const String& fileName = "" ); Directory( const FilePath& filePath ); virtual ~Directory(); /** * sets the name of the Directory * and creates the peer if it does not exists yet * It makes sure the name is a well formed directory name * i.e. with the 'DirectorySeparator' at the end *@param fileName the name */ virtual void setName( const String& fileName ); /** * Creates, initializes and returns a Finder object to perform a * directory/files search. *@param String a filter string for a simple filtering of the file names. *@param String a filter string for a simple filtering of the path names. *These two strings are internally represented by *an instance of FileSearchFilterStandard. *@throw BasicException if the filename is not a full path name. */ Finder* findFiles( const String& filterFile = L"", const String& filterDir = L"" ); /** * Creates, initializes and returns a Finder object to perform a directory/files search. *@param FileSearchFilter a filter object to filter the search for files and/or subdirectories. * Use NULL to disable any filtering on files or subdirectories. *@param bool ownFilterFileObject true if you want the Finder to be responsible for its deletion * Please use false when the filter object is allocated on the stack. *@throw BasicException if the filename is not a full path name. */ Finder* findFiles( FileSearchFilter* filterFileObject, const bool& ownFilterFileObject = false );public: //Finder* finder_;};///////////////////////////////////////////////////////////////////////////////// FileSearchFilter /**\class FileSearchFilter Directory.h "vcf/FoundationKit/Directory.h"FileSearchFilter is an abstract class for any user defined Filter objectworking with the Directory::Finder*/class FOUNDATIONKIT_API FileSearchFilter {public: virtual ~FileSearchFilter(){}; /** * the filtering function of the object, called by the Directory::Finder during the search * @param File* the pointer to the File object and its informations retrieved by the Finder, * file can also represent a directory on the file system. * @param Directory* the pointer to the object representing the subdirectory containing file. * @param Finder* the pointer to the active Directory::Finder* object performing the search * when the call to this function is made. * The user is allowed to assume that all these arguments are never NULL. * @return File* the passed argument File* itself if filter is passed, but * <B>it must return NULL if File dind't pass the filter</B> */ virtual File* passSearchFilter( const File* file, const Directory* subdir, const Directory::Finder* finder ) = 0; virtual String toString() { return L""; };};/**\class FileSearchFilterStandard Directory.h "vcf/FoundationKit/Directory.h"FileSearchFilterStandard is the predefined Filter objectused for simple searches.*/class FOUNDATIONKIT_API FileSearchFilterStandard : public FileSearchFilter {public: /** the constructor @param String the filter list for files. @param String the filter list for subdirectories. The items in these list are separated by separator, which is the ';' character by default. The wildcard character '*' is accepted, as in the implementation of FilePath::wildCharsMatchName() A specification like "*.vpl" does not implies that we are excluding directories from the search. Please use setDisplayMode( Directory::Finder::dmFiles ) for this. @param String the separator between items in filterFileList and filterDirList. @param fileAttributes the file attributes of the files we want to retrieve. */ FileSearchFilterStandard( const String& basenameFilterList, const String& pathnameFilterList = L"", const String& separator = L";" ); virtual ~FileSearchFilterStandard(){}; virtual File* passSearchFilter( const File* file, const Directory* subdir, const Directory::Finder* finder ); /** build the filter starting from the filter string @param String the filter string for files. @param String the filter string for subdirectories. */ void buildSearchFilters( const String& basenameFilterList, const String& pathnameFilterList = L"", const String& separator = L";" ); virtual String toString() { return ( basenameFilterList_ + " in " + pathnameFilterList_ ); };public: String basenameFilterList_; String pathnameFilterList_; std::vector<String> searchFiltersBasename_; std::vector<String> searchFiltersPathname_; std::vector<String>::iterator searchFilterIterator_; String separator_;};///////////////////////////////////////////////////////////////////////////////// inlinesinline void Directory::setName( const String& fileName ) { File::setName( FilePath::makeDirectoryName( fileName ) );}}; //end of namespace VCF/***CVS Log info*$Log$*Revision 1.7 2006/04/07 02:35:34 ddiego*initial checkin of merge from 0.6.9 dev branch.**Revision 1.6.2.3 2006/03/26 22:37:35 ddiego*minor update to source docs.**Revision 1.6.2.2 2006/03/19 00:04:16 obirsoy*Linux FoundationKit improvements.**Revision 1.6.2.1 2006/03/12 22:01:40 ddiego*doc updates.**Revision 1.6 2005/07/18 03:54:19 ddiego*documentation updates.**Revision 1.5 2005/01/02 03:04:22 ddiego*merged over some of the changes from the dev branch because they're important resoource loading bug fixes. Also fixes a few other bugs as well.**Revision 1.4 2004/12/10 16:59:14 marcelloptr*updated a comment**Revision 1.3.2.1 2004/12/06 22:01:40 marcelloptr*updated a comment**Revision 1.3 2004/12/01 04:31:40 ddiego*merged over devmain-0-6-6 code. Marcello did a kick ass job*of fixing a nasty bug (1074768VCF application slows down modal dialogs.)*that he found. Many, many thanks for this Marcello.**Revision 1.2.2.2 2004/11/10 19:09:45 marcelloptr*fixed documentation for doxygen**Revision 1.2.2.1 2004/09/18 20:08:17 marcelloptr*improved comments**Revision 1.2 2004/08/07 02:49:13 ddiego*merged in the devmain-0-6-5 branch to stable**Revision 1.1.2.9 2004/07/23 19:51:13 marcelloptr*minor changes on File / Directory stuff**Revision 1.1.2.8 2004/07/23 04:21:46 ddiego*more checkins**Revision 1.1.2.7 2004/07/23 00:56:37 ddiego*added the latest changes to the File and Directory finder classes.**Revision 1.1.2.6 2004/07/20 02:03:13 ddiego*fixed some miscellaneous bugs in directory search code. Many*thanks to Marcello for helping out on this.**Revision 1.1.2.5 2004/07/19 04:08:53 ddiego*more files and directories integration. Added Marcello's Directories example as well**Revision 1.1.2.4 2004/07/18 14:45:19 ddiego*integrated Marcello's new File/Directory API changes into both*the FoundationKit and the ApplicationKit. Many, many thanks go out*to Marcello for a great job with this. This adds much better file searching*capabilities, with many options for how to use it and extend it in the*future.**Revision 1.1.2.3 2004/06/06 07:05:32 marcelloptr*changed macros, text reformatting, copyright sections**Revision 1.1.2.2 2004/04/29 04:07:07 marcelloptr*reformatting of source files: macros and csvlog and copyright sections**Revision 1.1.2.1 2004/04/28 03:29:39 ddiego*migration towards new directory structure**Revision 1.4.4.1 2004/04/26 21:58:45 marcelloptr*changes for dir reorganization: _VCF_MACRO_H__**Revision 1.4 2003/12/18 05:15:59 ddiego*merge from devmain-0-6-2 branch into the stable branch**Revision 1.3.4.2 2003/10/23 04:24:51 ddiego*more musical chairs with headers again, in yet another attempt to make*them more efficent to speed up compiles.*Removed all teh template RTTI classes and put them all in one header*called VCFRTTIImpl.h. This should help compile speeds a bit.*The next step is to look at some of the event classes and remove ones*that aren't really neccessary - I'd estimate that 50% of the current*event classes are unneccessary and can be removed.**Revision 1.3.4.1 2003/08/25 03:46:38 ddiego*some fixes to some of the stream impls**Revision 1.3 2003/05/17 20:37:14 ddiego*this is the checkin for the 0.6.1 release - represents the merge over from*the devmain-0-6-0 branch plus a few minor bug fixes**Revision 1.2.22.1 2003/03/12 03:11:43 ddiego*switched all member variable that used the "m_"<name> prefix to* <name>"_" suffix nameing standard.*Also changed all vcf builder files to accomadate this.*Changes were made to the Stream classes to NOT multiple inheritance and to*be a little more correct. Changes include breaking the FileStream into two*distinct classes, one for input and one for output.**Revision 1.2 2002/01/24 01:46:48 ddiego*added a cvs "log" comment to the top of all files in vcf/src and vcf/include*to facilitate change tracking**/#endif // _VCF_DIRECTORY_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -