00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _ZIPFILE_
00019 #define _ZIPFILE_
00020
00021 #include <map>
00022 #include <stdio.h>
00023 #include <string>
00024
00025 class ZipFile
00026 {
00027 private:
00028 typedef std::map<std::string, int> ZipContentsMap;
00029
00030 FILE* m_pZipFile;
00031 char* m_pDataBuffer;
00032 int m_nEntries;
00033 ZipContentsMap m_contents;
00034
00035 struct ZipDirectoryHeader;
00036 struct ZipDirectoryFileHeader;
00037 struct ZipLocalHeader;
00038
00039 const ZipDirectoryFileHeader** m_pDirEntries;
00040 public:
00041
00042 ZipFile()
00043 :m_pZipFile(0), m_pDataBuffer(0), m_nEntries(0)
00044 {
00045 }
00046
00047 bool Start(const std::string& file);
00048 void Finish();
00049
00050 int GetFileCount() const { return m_nEntries; }
00051 std::string GetFileName(int nIndex) const;
00052 int GetFileLength(int nFile) const;
00053 bool ReadFile(const int nIndex, void* pBuffer);
00054 int FindFile(const std::string& path) const;
00055 };
00056
00057 #endif