00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __FILEMANAGER_H
00022 #define __FILEMANAGER_H
00023
00024 #include <stdio.h>
00025 #include <vector>
00026
00027 #ifndef DIR_SEPARATOR
00028 #define DIR_SEPARATOR '/'
00029 #endif
00030
00032 class FileManager
00033 {
00034 private:
00036 std::vector<const char *> dirList;
00037
00038 #ifdef WITH_DIRECTORY_LISTING
00039
00040 std::vector<const char *> fileList;
00042 int fileListIndex;
00043 #endif
00044
00045 int dirListIndexCache;
00046
00047 private:
00049 void clearDirList(void);
00050 #ifdef WITH_DIRECTORY_LISTING
00051
00052 void clearFileList(void);
00054 bool addListingForDir(const char *realDir, const char *extension);
00055 #endif
00056
00057 FILE *openWithbackupFP(const char *filename, const char *mode);
00058
00059 public:
00061 FileManager();
00063 virtual ~FileManager();
00064
00066 void addDir(const char *dir);
00067
00069 void remove(const char *filename);
00070
00072 FILE *openFP(const char *filename, const char *mode, bool verboseIfNotFound=true);
00073
00074 #ifdef WITH_DIRECTORY_LISTING
00075
00077
00079
00080 #endif
00081 };
00082
00084 extern FileManager *fileManagerPtr;
00085
00086 #endif