Matrix Science header

ms_zip.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_zip.hpp                                                           #
00004 # 'msparser' toolkit                                                         #
00005 # Utilities class for zipping and unzipping a buffer                         #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2006 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #    $Archive:: /Mowse/ms_mascotresfile/include/ms_zip.hpp       $ #
00012 #     $Author: villek@matrixscience.com $ #
00013 #       $Date: 2018-07-30 16:23:53 +0100 $ #
00014 #   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef ms_zip_HPP
00020 #define ms_zip_HPP
00021 
00022 
00023 #include <string>
00024 
00025 
00026 namespace matrix_science {
00032 
00033 
00092     class MS_MASCOTRESFILE_API ms_zip : public ms_errors
00093     {
00094     public:
00096         ms_zip(const bool isZipped, const unsigned char * buffer, const unsigned long len);
00097 
00099         ms_zip(const bool isZipped, const std::string & buffer);
00100 
00102         explicit ms_zip(const bool isZipped);
00103 
00105         ms_zip(const ms_zip& src);
00106 
00108         void copyFrom(const ms_zip* right);
00109 
00110 #ifndef SWIG
00111 
00112         ms_zip& operator=(const ms_zip& right);
00113 #endif
00114         ~ms_zip();
00115 
00117         std::string compressMore(const std::string& dataIn);
00118 
00120         void compressMore(const unsigned char *dataIn, const unsigned long inputLen, unsigned char *dataOut, unsigned long *outputLen);
00121 
00123         unsigned long getZipped(unsigned char * buffer, const unsigned long len) const;
00124 
00126         unsigned long getUnZipped(unsigned char * buffer, const unsigned long len) const;
00127 
00129         std::string getZipped() const;
00130 
00132         std::string getUnZipped() const;
00133 
00135         unsigned long getZippedLen() const;
00136 
00138         unsigned long getUnZippedLen() const;
00139 
00140         enum { MAX_UNCOMPRESSED_SIZE = (1024 * 1024 * 100) };
00141     private:
00142         void init_buffer(const bool isZipped, const unsigned char * buffer, const unsigned long len);
00143         unsigned long zippedLen_;
00144         unsigned long zippedCap_;
00145         unsigned long maxZippedCap_;
00146         unsigned long unZippedLen_;
00147         unsigned long unZippedCap_;
00148         unsigned char * pUnZipped_;
00149         unsigned char * pZipped_;
00150         void* pInStreamData_;
00151         bool doneStreaming_;
00152     }; // class ms_zip // end of tools_group
00154 } // namespace matrix_science
00155 #endif // ms_zip_HPP
00156 
00157 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:30