00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OPENMS_SYSTEM_FILE_H
00029 #define OPENMS_SYSTEM_FILE_H
00030
00031 #include <vector>
00032 #include <OpenMS/CONCEPT/Types.h>
00033 #include <OpenMS/config.h>
00034
00035 #ifdef OPENMS_WINDOWSPLATFORM
00036 #undef _WIN32_WINNT // avoid warning
00037 #define _WIN32_WINNT 0x0500
00038 #include <Windows.h>
00039 #endif
00040
00041 namespace OpenMS
00042 {
00043 class String;
00044
00050 class File
00051 {
00052 public:
00053
00055 static bool exists(const String& file);
00056
00058 static bool empty(const String& file);
00059
00065 static bool remove(const String& file);
00066
00068 static void absolutePath(String& file);
00069
00071 static String basename(const String& file);
00072
00074 static String path(const String& file);
00075
00077 static bool readable(const String& file);
00078
00080 static bool writable(const String& file);
00081
00091 static String find(const String& filename, std::vector<String> directories = std::vector<String>());
00092
00098 static bool fileList(const String& dir, const String& file_pattern, std::vector<String>& output);
00099
00101 static String getUniqueName();
00102
00109 static bool createSparseFile(const String& filename, const Offset64Int& filesize);
00110
00117 #ifdef OPENMS_WINDOWSPLATFORM
00118 static bool extendSparseFile(const HANDLE& hFile, const Offset64Int& filesize);
00119 #else
00120 static bool extendSparseFile(const int& hFile, const Offset64Int& filesize);
00121 #endif
00122
00134 #ifdef OPENMS_WINDOWSPLATFORM
00135 static HANDLE getSwapFileHandle(const String& filename, const Offset64Int& filesize, const bool& create);
00136 #else
00137 static int getSwapFileHandle(const String& filename, const Offset64Int& filesize, const bool& create);
00138 #endif
00139
00143 #ifdef OPENMS_WINDOWSPLATFORM
00144 static void closeSwapFileHandle(const HANDLE & f_handle);
00145 #else
00146 static void closeSwapFileHandle(const int & f_handle);
00147 #endif
00148
00149 };
00150
00151 }
00152
00153 #endif // OPENMS_SYSTEM_FILE_H