00001 /***************************************************************** 00002 | 00003 | Neptune - Zip Support 00004 | 00005 | (c) 2007 Gilles Boccon-Gibod 00006 | Author: Gilles Boccon-Gibod (bok@bok.net) 00007 | 00008 ****************************************************************/ 00009 00010 #ifndef _NPT_ZIP_H_ 00011 #define _NPT_ZIP_H_ 00012 00013 /*---------------------------------------------------------------------- 00014 | includes 00015 +---------------------------------------------------------------------*/ 00016 #include "NptConfig.h" 00017 #include "NptStreams.h" 00018 00019 /*---------------------------------------------------------------------- 00020 | NPT_ZipInflatingInputStream 00021 +---------------------------------------------------------------------*/ 00022 //class NPT_ZipInflatingInputStream : public NPT_InputStream 00023 //{ 00024 //public: 00025 // NPT_ZipInflatingInputStream(NPT_InputStreamReference& source); 00026 // 00027 //private: 00028 // 00029 //}; 00030 00031 /*---------------------------------------------------------------------- 00032 | NPT_ZipInflatingOutputStream 00033 +---------------------------------------------------------------------*/ 00034 00035 /*---------------------------------------------------------------------- 00036 | NPT_ZipDeflatingInputStream 00037 +---------------------------------------------------------------------*/ 00038 00039 /*---------------------------------------------------------------------- 00040 | NPT_ZipDeflatingInputStream 00041 +---------------------------------------------------------------------*/ 00042 00043 /*---------------------------------------------------------------------- 00044 | NPT_Zip 00045 +---------------------------------------------------------------------*/ 00046 const int NPT_ZIP_COMPRESSION_LEVEL_DEFAULT = -1; 00047 const int NPT_ZIP_COMPRESSION_LEVEL_MIN = 0; 00048 const int NPT_ZIP_COMPRESSION_LEVEL_MAX = 9; 00049 const int NPT_ZIP_COMPRESSION_LEVEL_NONE = 0; 00050 class NPT_Zip 00051 { 00052 public: 00056 typedef enum { 00057 ZLIB, 00058 GZIP 00059 } Format; 00060 00064 static NPT_Result Deflate(const NPT_DataBuffer& in, 00065 NPT_DataBuffer& out, 00066 int compression_level = NPT_ZIP_COMPRESSION_LEVEL_DEFAULT, 00067 Format format = ZLIB); 00068 00072 static NPT_Result Inflate(const NPT_DataBuffer& in, 00073 NPT_DataBuffer& out); 00074 00075 private: 00076 static NPT_Result MapError(int err); 00077 }; 00078 00079 #endif // _NPT_ZIP_H_