U7file.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2000  Dancer A.L Vesperman
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 
00020 #ifndef _U7FILE_H_
00021 #define _U7FILE_H_
00022 
00023 #include <map>
00024 #include <string>
00025 
00026 #include "common_types.h"
00027 
00028 
00029 
00030 class U7file
00031 {
00032 public:
00033   std::string filename;
00034   U7file() {}
00035   U7file(const std::string &name) : filename(name) {}
00036   U7file(const U7file &f) : filename(f.filename) {}
00037   U7file &operator=(const U7file &u) { filename=u.filename; return *this; }
00038   virtual ~U7file() {}
00039 
00040   virtual uint32  number_of_objects(void)=0;
00041   virtual char *  retrieve(uint32 objnum,std::size_t &len)=0;
00042   virtual const char *get_archive_type()=0;
00043 };
00044 
00045 class U7FileManager
00046 {
00047 protected:
00048   class exclusive {};
00049 #if 0
00050   struct ltstr
00051   {
00052     bool operator()(const std::string &s1, const std::string &s2) const
00053     {
00054       return s1<s2;
00055     }
00056   };
00057   std::map<const std::string,U7file *,ltstr> file_list;
00058 #endif
00059   std::map<std::string,U7file *> file_list;
00060 
00061 
00062   static  U7FileManager *self;
00063 
00064 public:
00065   U7FileManager();
00066   ~U7FileManager();
00067 
00068   void reset();
00069 
00070   U7file  *get_file_object(const std::string &s);
00071   static U7FileManager *get_ptr(void);
00072 };
00073 
00074 class U7object
00075 {
00076 protected:
00077   std::string filename;
00078   int objnumber;
00079 
00080 public:
00081   U7object(const std::string &file,int objnum) : filename(file),objnumber(objnum) {}
00082   virtual ~U7object() {}
00083 
00084   uint32  number_of_objects(void);
00085   virtual char *  retrieve(std::size_t &len);
00086   bool      retrieve(const char *fname);
00087           // FIX ME - this is only used in Game::play_audio and should be removed
00088 };
00089 
00090 #endif

Generated on Mon Jul 9 14:42:45 2007 for ExultEngine by  doxygen 1.5.1