00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef __FILEFNDR_H 00011 #define __FILEFNDR_H 00012 00013 #include "DateTime.h" 00014 00015 #include <string> 00016 00017 /** 00018 * Provides capability for file system searches 00019 * 00020 * A platform-independent tool for searching the file system and 00021 * querying file attributes. 00022 * 00023 * @see Filename 00024 */ 00025 class FileFinder 00026 { 00027 public: 00028 /** 00029 * Determine if any files meet client's criteria. 00030 * 00031 * @param path 00032 * The directory to search. 00033 * 00034 * @param criteria 00035 * Search criteria. This is operating system dependent but 00036 * generally contains either a filename, a glob, or is empty. 00037 * An empty string will search for all files. 00038 * 00039 * @param includeDirectories 00040 * Should subdirectories be includes in the results? If false, only files are included. 00041 * 00042 * @return True if any files were identified as meeting the 00043 * criteria. 00044 */ 00045 virtual bool findFile(const std::string& path, const std::string& criteria, bool includeDirectories = false) = 0; 00046 00047 /** 00048 * Designate first/next entry in list of qualified files. 00049 * 00050 * @return True if another file has qualified and can be 00051 * interrogated for status by the application. 00052 */ 00053 virtual bool findNextFile() = 0; 00054 00055 /** 00056 * Get the length of the current qualified file. 00057 * 00058 * @return The length, as determined by the operating system, 00059 * of the current file. 00060 */ 00061 virtual double getLength() const = 0; 00062 00063 /** 00064 * Get the filename, without any path information, of the 00065 * current qualified file. 00066 * 00067 * @return The name of the current file. 00068 */ 00069 virtual std::string getFileName() const = 0; 00070 00071 /** 00072 * Get the path information of the 00073 * current qualified file. 00074 * 00075 * @return The path of the current file. 00076 */ 00077 virtual std::string getFilePath() const = 0; 00078 00079 /** 00080 * Get the filename, without any path or extension information, 00081 * of the current qualified file. 00082 * 00083 * @param fileTitle 00084 * The name of the current file. 00085 * 00086 * @return True if the current file title was successfully set, 00087 * otherwise false. 00088 */ 00089 virtual bool getFileTitle(std::string& fileTitle) const = 0; 00090 00091 /** 00092 * Get the filename and path information, of the 00093 * current qualified file. 00094 * 00095 * @param fullFilePath 00096 * The full path of the current file. 00097 * 00098 * @return True if the full path of the current file was 00099 * successfully set, otherwise false. 00100 */ 00101 virtual bool getFullPath(std::string& fullFilePath) const = 0; 00102 00103 /** 00104 * Get the last access time of the current qualified file. 00105 * 00106 * @param dt 00107 * The date/time of last access, as determined by the 00108 * operating system, of the current file. 00109 */ 00110 virtual void getLastAccessTime(DateTime& dt) const = 0; 00111 00112 /** 00113 * Get the last modification time of the current qualified file. 00114 * 00115 * @param dt 00116 * The date/time of last change, as determined by the 00117 * operating system, of the current file. 00118 */ 00119 virtual void getLastModificationTime(DateTime& dt) const = 0; 00120 00121 /** 00122 * Determine if the entry is either the current or parent directory 00123 * 00124 * @return True if the current file is either "." or ".." 00125 */ 00126 virtual bool isDots() const = 0; 00127 00128 /** 00129 * Determine if the entry is a directory 00130 * 00131 * @return True if the current file is a directory. 00132 */ 00133 virtual bool isDirectory() const = 0; 00134 00135 /** 00136 * Determine if the current entry is read-only. 00137 * 00138 * @return True if the current file is read-only for the current user. 00139 */ 00140 virtual bool isReadOnly() const = 0; 00141 00142 protected: 00143 /** 00144 * This should be destroyed by calling ObjectFactory::destroyObject. 00145 */ 00146 virtual ~FileFinder() {} 00147 }; 00148 00149 #endif // __FILEFNDR_H