FIFE 2008.0
|
00001 /*************************************************************************** 00002 * Copyright (C) 2005-2008 by the FIFE team * 00003 * http://www.fifengine.de * 00004 * This file is part of FIFE. * 00005 * * 00006 * FIFE is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Lesser General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2.1 of the License, or (at your option) any later version. * 00010 * * 00011 * This library 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. See the GNU * 00014 * Lesser General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Lesser General Public * 00017 * License along with this library; if not, write to the * 00018 * Free Software Foundation, Inc., * 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 00020 ***************************************************************************/ 00021 00022 #ifndef FIFE_MAP_LOADERS_FALLOUT_DAT2_H 00023 #define FIFE_MAP_LOADERS_FALLOUT_DAT2_H 00024 00025 // Standard C++ library includes 00026 #include <map> 00027 #include <string> 00028 00029 // Platform specific includes 00030 #include "util/base/fife_stdint.h" 00031 00032 // 3rd party library includes 00033 #include <boost/scoped_ptr.hpp> 00034 00035 // FIFE includes 00036 // These includes are split up in two parts, separated by one empty line 00037 // First block: files included from the FIFE root src directory 00038 // Second block: files included from the same folder 00039 #include "util/time/timer.h" 00040 #include "vfs/vfs.h" 00041 #include "vfs/vfssource.h" 00042 00043 #include "rawdatadat2.h" 00044 00045 namespace FIFE { 00046 class RawData; 00047 00059 class DAT2 : public VFSSource { 00060 00061 public: 00066 DAT2(VFS* vfs, const std::string& path); 00067 00068 bool fileExists(const std::string& name) const; 00069 RawData* open(const std::string& file) const; 00070 00075 const RawDataDAT2::s_info& getInfo(const std::string& name) const; 00076 00077 std::set<std::string> listFiles(const std::string& pathstr) const; 00078 std::set<std::string> listDirectories(const std::string& pathstr) const; 00079 00080 private: 00081 std::string m_datpath; 00082 mutable boost::scoped_ptr<RawData> m_data; 00083 typedef std::map<std::string, RawDataDAT2::s_info> type_filelist; 00084 mutable type_filelist m_filelist; 00085 00087 mutable uint32_t m_filecount; 00089 mutable unsigned int m_currentIndex; 00091 mutable Timer m_timer; 00092 00094 void readFileEntry() const; 00095 00097 type_filelist::const_iterator findFileEntry(const std::string& name) const; 00098 00099 std::set<std::string> list(const std::string& pathstr, bool dirs) const; 00100 00101 // Not copyable 00102 DAT2(const DAT2&); 00103 DAT2& operator=(const DAT2&); 00104 }; 00105 00106 } // FIFE 00107 00108 #endif