Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_zip.hpp
1/*
2##############################################################################
3# file: ms_zip.hpp #
4# 'msparser' toolkit #
5# Utilities class for zipping and unzipping a buffer #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2023 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11# $Archive:: /Mowse/ms_mascotresfile/include/ms_zip.hpp $ #
12# $Author: villek@matrixscience.com $ #
13# $Date: 2023-08-25 09:37:06 +0100 $ #
14# $Revision: a93b9fa8957b5f46765e9c3292c87eda6e2ca94c | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
15# $NoKeywords:: $ #
16##############################################################################
17*/
18
19#ifndef ms_zip_HPP
20#define ms_zip_HPP
21
22
23#include <string>
24
25
26namespace matrix_science {
33
113 class MS_MASCOTRESFILE_API ms_zip : public ms_errors
114 {
115 public:
117 ms_zip(const bool isZipped, const unsigned char * buffer, const unsigned long len);
118
120 ms_zip(const bool isZipped, const std::string & buffer);
121
123 explicit ms_zip(const bool isZipped);
124
126 ms_zip(const ms_zip& src);
127
129 void copyFrom(const ms_zip* right);
130
131#ifndef SWIG
133 ms_zip& operator=(const ms_zip& right);
134#endif
135 ~ms_zip();
136
138 std::string compressMore(const std::string& dataIn);
139
141 void compressMore(const unsigned char *dataIn, const unsigned long inputLen, unsigned char *dataOut, unsigned long *outputLen);
142
144 std::string decompressMore(const std::string &dataIn);
145
147 void decompressMore(const unsigned char *dataIn, const unsigned long inputLen, unsigned char *dataOut, unsigned long *outputLen);
148
150 unsigned long getZipped(unsigned char * buffer, const unsigned long len) const;
151
153 unsigned long getUnZipped(unsigned char * buffer, const unsigned long len) const;
154
156 std::string getZipped() const;
157
159 std::string getUnZipped() const;
160
162 unsigned long getZippedLen() const;
163
165 unsigned long getUnZippedLen() const;
166
167 enum { MAX_UNCOMPRESSED_SIZE = (1024 * 1024 * 100), MAX_COMPRESSED_SIZE = (1024 * 1024 * 100) };
168 private:
169 void init_buffer(const bool isZipped, const unsigned char * buffer, const unsigned long len);
170 unsigned long zippedLen_;
171 unsigned long zippedCap_;
172 unsigned long maxZippedCap_;
173 unsigned long maxUnZippedCap_;
174 unsigned long unZippedLen_;
175 unsigned long unZippedCap_;
176 unsigned char * pUnZipped_;
177 unsigned char * pZipped_;
178 void* pInStreamData_;
179 void* pOutStreamData_;
180 bool doneStreaming_;
181 typedef std::basic_string<unsigned char> ustring;
182 std::list<ustring> outputQueue_;
183 }; // class ms_zip // end of tools_group
185} // namespace matrix_science
186#endif // ms_zip_HPP
187
188/*------------------------------- End of File -------------------------------*/
This class is used as a base class for several Mascot Parser classes.
Definition: ms_errors.hpp:696
Utility class for compressing and decompressing data in compress format, and compressing in gzip form...
Definition: ms_zip.hpp:114
ms_zip & operator=(const ms_zip &right)
C++ style assignment operator.