ZipArchive.h

Go to the documentation of this file.
00001 #ifndef ZIPARCHIVE_H_
00002 #define ZIPARCHIVE_H_
00003 
00004 #include "iarchive.h"
00005 #include "fs_filesystem.h"
00006 #include "stream/filestream.h"
00007 #include "AutoPtr.h"
00008 
00009 class ZipRecord
00010 {
00011     public:
00012         enum ECompressionMode
00013         {
00014             eStored, eDeflated,
00015         };
00016 
00017         ZipRecord (unsigned int position, unsigned int compressed_size, unsigned int uncompressed_size,
00018                 ECompressionMode mode) :
00019             m_position(position), m_stream_size(compressed_size), m_file_size(uncompressed_size), m_mode(mode)
00020         {
00021         }
00022 
00023         unsigned int m_position;
00024         unsigned int m_stream_size;
00025         unsigned int m_file_size;
00026         ECompressionMode m_mode;
00027 };
00028 typedef GenericFileSystem<ZipRecord> ZipFileSystem;
00029 
00030 class ZipArchive: public Archive
00031 {
00032         ZipFileSystem m_filesystem;
00033         std::string m_name;
00034         FileInputStream m_istream;
00035 
00036     public:
00037         ZipArchive (const std::string& name);
00038         virtual ~ZipArchive ();
00039 
00040         bool failed ();
00041 
00042         virtual ArchiveFile* openFile (const std::string& name);
00043         virtual ArchiveTextFile* openTextFile (const std::string& name);
00044 
00045         bool containsFile (const std::string& name);
00046         void forEachFile (VisitorFunc visitor, const std::string& root);
00047 
00048     private:
00049         bool read_record ();
00050         bool read_pkzip ();
00051 };
00052 typedef AutoPtr<ZipArchive> ZipArchivePtr;
00053 
00054 #endif /*ZIPARCHIVE_H_*/

Generated by  doxygen 1.6.2