OGRE  1.8
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreDeflate.h
Go to the documentation of this file.
1 /*
2  -----------------------------------------------------------------------------
3  This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5  For the latest info, see http://www.ogre3d.org/
6 
7  Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9  Permission is hereby granted, free of charge, to any person obtaining a copy
10  of this software and associated documentation files (the "Software"), to deal
11  in the Software without restriction, including without limitation the rights
12  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13  copies of the Software, and to permit persons to whom the Software is
14  furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in
17  all copies or substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25  THE SOFTWARE.
26  -----------------------------------------------------------------------------
27  */
28 #ifndef __OGRE_DEFLATE_H__
29 #define __OGRE_DEFLATE_H__
30 
31 #include "OgrePrerequisites.h"
32 #include "OgreDataStream.h"
33 
34 
36 struct z_stream_s;
37 typedef struct z_stream_s z_stream;
38 
39 namespace Ogre
40 {
56  {
57  protected:
62  size_t mCurrentPos;
63 
66 
68  unsigned char *mTmp;
69 
72 
73 
74  void init();
75  void destroy();
76  void compressFinal();
77  public:
83  DeflateStream(const DataStreamPtr& compressedStream, const String& tmpFileName = "");
90  DeflateStream(const String& name, const DataStreamPtr& compressedStream, const String& tmpFileName="");
91 
92  ~DeflateStream();
93 
100  bool isCompressedStreamValid() const { return mIsCompressedValid; }
101 
104  size_t read(void* buf, size_t count);
105 
108  size_t write(const void* buf, size_t count);
109 
112  void skip(long count);
113 
116  void seek( size_t pos );
117 
120  size_t tell(void) const;
121 
124  bool eof(void) const;
125 
128  void close(void);
129 
130  };
131 }
132 
133 #endif
#define _OgreExport
Definition: OgrePlatform.h:233
DataStreamPtr mTmpWriteStream
Definition: OgreDeflate.h:59
StaticCache< 16 *OGRE_STREAM_TEMP_SIZE > mReadCache
Cache for read data in case skipping around.
Definition: OgreDeflate.h:65
z_stream * mZStream
Definition: OgreDeflate.h:61
unsigned char * mTmp
Intermediate buffer for read / write.
Definition: OgreDeflate.h:68
struct z_stream_s z_stream
Definition: OgreDeflate.h:37
bool mIsCompressedValid
Whether the underlying stream is valid compressed data.
Definition: OgreDeflate.h:71
DataStreamPtr mCompressedStream
Definition: OgreDeflate.h:58
Stream which compresses / uncompresses data using the 'deflate' compression algorithm.
Definition: OgreDeflate.h:55
General purpose class used for encapsulating the reading and writing of data.
bool isCompressedStreamValid() const
Returns whether the compressed stream is valid deflated data.
Definition: OgreDeflate.h:100
_StringBase String