Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

pgfilearchive.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000,2001,2002  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: mbickel $
00023     Update Date:      $Date: 2008-02-01 22:15:09 $
00024     Source File:      $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/pgfilearchive.h,v $
00025     CVS/RCS Revision: $Revision: 1.3 $
00026     Status:           $State: Exp $
00027 */
00028 
00034 #ifndef PG_FILEARCHIVE_H
00035 #define PG_FILEARCHIVE_H
00036 
00037 #include "paragui.h"
00038 #include "pgfile.h"
00039 #include "pgsurfacecache.h"
00040 #include "pgdatacontainer.h"
00041 
00042 #include <vector>
00043 #include <string>
00044 
00046 typedef std::vector< std::string > PG_FileList;
00047 
00054 class DECLSPEC PG_FileArchive {
00055 private:   
00056    void init( const char* argv0 );
00057    
00058 public:
00059 
00061         enum Mode {
00062             READ, 
00063             WRITE, 
00064             APPEND 
00065         };
00066 
00067         PG_FileArchive();
00068    PG_FileArchive( const char* argv0);
00069    
00070         ~PG_FileArchive();
00071 
00072         static void Deinit();
00073 
00080         static bool AddArchive(const std::string& arch, bool append = true);
00081 
00087         static bool RemoveArchive(const std::string& arch);
00088 
00092         static bool RemoveAllArchives();
00093 
00095 
00105         static char **GetSearchPath();
00106 
00108 
00114         static void FreeList(void* list);
00115 
00117 
00129         static char **EnumerateFiles(const std::string& dir);
00130 
00136         static bool Exists(const std::string& filename);
00137 
00143         static bool IsDirectory(const std::string& filename);
00144 
00149         static const char* GetDirSeparator();
00150 
00151         static const char* GetRealDir(const std::string&filename);
00152 
00153         static const char* GetLastError();
00155 
00160         static bool MakeDir(const std::string& dir);
00161 
00163 
00167         static bool SetWriteDir(const std::string& dir);
00168 
00170 
00177         static std::string *PathToPlatform(const std::string& path);
00178 
00180 
00183         static const char* GetBaseDir();
00184 
00186 
00192         static const char* GetUserDir();
00193 
00195 
00200         static const char* GetWriteDir();
00201 
00203 
00218         static bool SetSaneConfig(const std::string& organization,
00219                                   const std::string& appName,
00220                                   const std::string& archiveExt = PG_NULLSTR,
00221                                   bool includeCdRoms = false,
00222                                   bool archivesFirst = true);
00223 
00230         static PG_File* OpenFile(const std::string& filename, Mode mode = READ);
00231 
00238         static SDL_RWops* OpenFileRWops(const std::string& filename, Mode mode = READ);
00239 
00241 
00248         static PG_DataContainer* ReadFile(const std::string& filename);
00249 
00257         static SDL_Surface* LoadSurface(const std::string& filename, bool convert = false);
00258 
00268         static SDL_Surface* LoadSurface(const std::string& filename, bool usekey, Uint32 colorkey, bool convert = false);
00269 
00276         static bool UnloadSurface(SDL_Surface* surface, bool bDeleteIfNotExists = true);
00277 
00287         static void EnableSymlinks(bool followSymlinks);
00288 
00290 
00299         static PG_FileList* GetSearchPathList();
00300 
00301 
00303 
00313         static PG_FileList* GetFileList(const std::string& dir, const std::string& wildcard="*");
00314 
00315 private:
00316 
00317         static Uint32 my_instance_count;
00318 
00319         static PG_SurfaceCache my_cache;
00320 };
00321 
00322 #endif

Generated on Tue Jun 24 01:27:47 2008 for Advanced Strategic Command by  doxygen 1.4.2