OgreDeflate.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __OGRE_DEFLATE_H__
#define __OGRE_DEFLATE_H__
#include "OgrePrerequisites.h"
#include "OgreDataStream.h"
#include "OgreHeaderPrefix.h"
struct z_stream_s;
typedef struct z_stream_s z_stream;
namespace Ogre
{
class _OgreExport DeflateStream : public DataStream
{
protected:
DataStreamPtr mCompressedStream;
DataStreamPtr mTmpWriteStream;
String mTempFileName;
z_stream* mZStream;
size_t mCurrentPos;
size_t mAvailIn;
StaticCache<16 * OGRE_STREAM_TEMP_SIZE> mReadCache;
unsigned char *mTmp;
bool mIsCompressedValid;
void init();
void destroy();
void compressFinal();
size_t getAvailInForSinglePass();
public:
DeflateStream(const DataStreamPtr& compressedStream, const String& tmpFileName = "",
size_t avail_in = 0);
DeflateStream(const String& name, const DataStreamPtr& compressedStream, const String& tmpFileName="",
size_t avail_in = 0);
~DeflateStream();
bool isCompressedStreamValid() const { return mIsCompressedValid; }
size_t read(void* buf, size_t count);
size_t write(const void* buf, size_t count);
void skip(long count);
void seek( size_t pos );
size_t tell(void) const;
bool eof(void) const;
void close(void);
};
}
#include "OgreHeaderSuffix.h"
#endif
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::DeflateStream::mAvailIn
size_t mAvailIn
Definition: OgreDeflate.h:63
Ogre::DeflateStream::mZStream
z_stream * mZStream
Definition: OgreDeflate.h:61
OgreDataStream.h
Ogre::DeflateStream::mCompressedStream
DataStreamPtr mCompressedStream
Definition: OgreDeflate.h:58
OgrePrerequisites.h
Ogre::DeflateStream::mIsCompressedValid
bool mIsCompressedValid
Whether the underlying stream is valid compressed data.
Definition: OgreDeflate.h:72
Ogre::DeflateStream::mCurrentPos
size_t mCurrentPos
Definition: OgreDeflate.h:62
Ogre::DataStream
General purpose class used for encapsulating the reading and writing of data.
Definition: OgreDataStream.h:176
Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::DeflateStream::isCompressedStreamValid
bool isCompressedStreamValid() const
Returns whether the compressed stream is valid deflated data.
Definition: OgreDeflate.h:108
Ogre::DeflateStream::mReadCache
StaticCache< 16 *OGRE_STREAM_TEMP_SIZE > mReadCache
Cache for read data in case skipping around.
Definition: OgreDeflate.h:66
Ogre::DeflateStream::mTmp
unsigned char * mTmp
Intermediate buffer for read / write.
Definition: OgreDeflate.h:69
OgreHeaderSuffix.h
Ogre::DeflateStream::mTempFileName
String mTempFileName
Definition: OgreDeflate.h:60
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::SharedPtr< DataStream >
OgreHeaderPrefix.h
Ogre::DeflateStream
Stream which compresses / uncompresses data using the &#39;deflate&#39; compression algorithm.
Definition: OgreDeflate.h:55
z_stream
struct z_stream_s z_stream
Definition: OgreDeflate.h:37
Ogre::DeflateStream::mTmpWriteStream
DataStreamPtr mTmpWriteStream
Definition: OgreDeflate.h:59

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.