00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIFE_MAP_LOADERS_FALLOUT_DAT2_H
00023 #define FIFE_MAP_LOADERS_FALLOUT_DAT2_H
00024
00025
00026 #include <map>
00027 #include <string>
00028
00029
00030 #include "util/base/fife_stdint.h"
00031
00032
00033 #include <boost/scoped_ptr.hpp>
00034
00035
00036
00037
00038
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
00102 DAT2(const DAT2&);
00103 DAT2& operator=(const DAT2&);
00104 };
00105
00106 }
00107
00108 #endif