Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

filemanager.h

00001 /*
00002  * Copyright (C) 2001-2003 Stephane Magnenat, Luc-Olivier de Charrière 
00003  * and Julien Pilet.  For any question or comment contact us at nct@ysagoon.com
00004  * or nuage@ysagoon.com
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
00014  * See the GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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         // FIXME : the following functions are not thread-safe :
00077         bool initDirectoryListing(const char *virtualDir, const char *extension);
00079         const char *getNextDirectoryEntry(void);
00080 #endif
00081 };
00082 
00084 extern FileManager *fileManagerPtr;
00085 
00086 #endif

Generated on Fri May 16 13:01:45 2003 for Jelie by doxygen1.2.15