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: davidc $ #
00013 #       $Date: 2013/04/15 14:47:05 $ #
00014 #   $Revision: 1.9 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef ms_zip_HPP
00020 #define ms_zip_HPP
00021 
00022 #ifdef _WIN32
00023 #pragma warning(disable:4251)   // Don't want all classes to be exported
00024 #pragma warning(disable:4786)   // Debug symbols too long
00025 #   ifndef _MATRIX_USE_STATIC_LIB
00026 #       ifdef MS_MASCOTRESFILE_EXPORTS
00027 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00028 #       else
00029 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00030 #       endif
00031 #   else
00032 #       define MS_MASCOTRESFILE_API
00033 #   endif
00034 #else
00035 #   define MS_MASCOTRESFILE_API
00036 #endif
00037 
00038 #include <string>
00039 
00040 
00041 namespace matrix_science {
00047 
00048 
00107     class MS_MASCOTRESFILE_API ms_zip : public ms_errors
00108     {
00109     public:
00111         ms_zip(const bool isZipped, const unsigned char * buffer, const unsigned long len);
00112 
00114         ms_zip(const bool isZipped, const std::string & buffer);
00115 
00117         explicit ms_zip(const bool isZipped);
00118 
00120         ms_zip(const ms_zip& src);
00121 
00123         void copyFrom(const ms_zip* right);
00124 
00125 #ifndef SWIG
00126 
00127         ms_zip& operator=(const ms_zip& right);
00128 #endif
00129         ~ms_zip();
00130 
00132         std::string compressMore(const std::string& dataIn);
00133 
00135         void compressMore(const unsigned char *dataIn, const unsigned long inputLen, unsigned char *dataOut, unsigned long *outputLen);
00136 
00138         unsigned long getZipped(unsigned char * buffer, const unsigned long len) const;
00139 
00141         unsigned long getUnZipped(unsigned char * buffer, const unsigned long len) const;
00142 
00144         std::string getZipped() const;
00145 
00147         std::string getUnZipped() const;
00148 
00150         unsigned long getZippedLen() const;
00151 
00153         unsigned long getUnZippedLen() const;
00154 
00155         enum { MAX_UNCOMPRESSED_SIZE = (1024 * 1024 * 100) };
00156     private:
00157         void init_buffer(const bool isZipped, const unsigned char * buffer, const unsigned long len);
00158         unsigned long zippedLen_;
00159         unsigned long zippedCap_;
00160         unsigned long maxZippedCap_;
00161         unsigned long unZippedLen_;
00162         unsigned long unZippedCap_;
00163         unsigned char * pUnZipped_;
00164         unsigned char * pZipped_;
00165         void* pInStreamData_;
00166         bool doneStreaming_;
00167     }; // class ms_zip // end of tools_group
00169 } // namespace matrix_science
00170 #endif // ms_zip_HPP
00171 
00172 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51