00001 00002 // 00003 // This file is part of the MADELINE 2 program 00004 // written by Edward H. Trager, Ritu Khanna and Adrian Marrs 00005 // Copyright (c) 2005 by the 00006 // Regents of the University of Michigan. 00007 // All Rights Reserved. 00008 // 00009 // The latest version of this program is available from: 00010 // 00011 // http://eyegene.ophthy.med.umich.edu/madeline/ 00012 // 00013 // Released under the GNU General Public License. 00014 // A copy of the GPL is included in the distribution 00015 // package of this software, or see: 00016 // 00017 // http://www.gnu.org/copyleft/ 00018 // 00019 // ... for licensing details. 00020 // 00022 // 00023 // Compressor.h 00024 // 00025 00026 #ifndef COMPRESSOR_INCLUDED 00027 #define COMPRESSOR_INCLUDED 00028 00029 #include <string> 00030 00031 #include <libxml/parser.h> 00032 #include <libxml/tree.h> 00033 #include <libxml/debugXML.h> 00034 00038 class Compressor 00039 { 00040 public: 00041 enum COMPRESSORFORMAT { ZIP, GZIP, BZIP2 }; 00042 enum DECOMPRESSORTYPE { INFILE, INSTREAM }; 00043 00044 const static int CASESENSITIVITY = 1; // Casesensitivity of XML filename 00045 const static int WRITEBUFFERSIZE = 8192;// Buffer size to extract the XML file 00046 00047 Compressor(){} 00048 00049 // void compress(const std::string& file, COMPRESSORFORMAT format = GZIP) {} 00050 std::string decompress(const std::string& file, const std::string& contents= "content.xml", DECOMPRESSORTYPE type = INFILE); 00051 // void decompressToFile(const std::string& file, const std::string& outFile= "unzippedconent.xml", const std::string& contents= "content.xml", DECOMPRESSORTYPE type = INFILE){} 00052 00053 // void getTableOfContents() {} 00054 00055 private: 00056 00057 std::string _decompressPKZIP(const std::string& file, const std::string& contents= "content.xml"); 00058 std::string _decompressGZIP(const std::string& file); 00059 std::string _decompressBZIP2(const std::string& file); 00060 00061 }; 00062 #endif 00063