gloox  1.0.20
compressionzlib.h
1 /*
2  Copyright (c) 2005-2017 by Jakob Schröter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 #ifndef COMPRESSIONZLIB_H__
15 #define COMPRESSIONZLIB_H__
16 
17 #include "compressionbase.h"
18 #include "mutex.h"
19 
20 #include "config.h"
21 
22 #ifdef HAVE_ZLIB
23 
24 #include <zlib.h>
25 
26 #include <string>
27 
28 namespace gloox
29 {
36  class GLOOX_API CompressionZlib : public CompressionBase
37  {
38  public:
44 
48  virtual ~CompressionZlib();
49 
50  // reimplemented from CompressionBase
51  virtual bool init();
52 
53  // reimplemented from CompressionBase
54  virtual void compress( const std::string& data );
55 
56  // reimplemented from CompressionBase
57  virtual void decompress( const std::string& data );
58 
59  // reimplemented from CompressionBase
60  virtual void cleanup();
61 
62  private:
63  z_stream m_zinflate;
64  z_stream m_zdeflate;
65 
66  util::Mutex m_compressMutex;
67 
68  };
69 
70 }
71 
72 #endif // HAVE_ZLIB
73 
74 #endif // COMPRESSIONZLIB_H__
This is an abstract base class for stream compression implementations.
A simple implementation of mutex as a wrapper around a pthread mutex or a win32 critical section...
Definition: mutex.h:33
The namespace for the gloox library.
Definition: adhoc.cpp:27
An abstract base class used to receive de/compressed data from a CompressionBase-derived object...