rle_decoder.hpp
Go to the documentation of this file.
/*
CLAW - a C++ Library Absolutely Wonderful
CLAW is a free library without any particular aim but being useful to
anyone.
Copyright (C) 2005-2011 Julien Jorge
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
contact: julien.jorge@gamned.org
*/
#ifndef __CLAW_RLE_DECODER_HPP__
#define __CLAW_RLE_DECODER_HPP__
namespace claw
{
template< typename Pattern, typename InputBuffer, typename OutputBuffer >
class rle_decoder
{
public:
typedef Pattern pattern_type;
typedef InputBuffer input_buffer_type;
typedef OutputBuffer output_buffer_type;
protected:
enum mode
{
stop,
raw,
compressed
}; // enum mode
public:
rle_decoder();
virtual ~rle_decoder();
void decode( input_buffer_type& input, output_buffer_type& output );
protected:
virtual void read_mode( input_buffer_type& input,
output_buffer_type& output ) = 0;
protected:
mode m_mode;
unsigned int m_count;
pattern_type m_pattern;
}; // class rle_decoder
} // namespace claw
#include <claw/impl/rle_decoder.tpp>
#endif // __CLAW_RLE_DECODER_HPP__
claw::rle_decoder::m_mode
mode m_mode
Current mode of the decompression.
Definition: rle_decoder.hpp:94
claw::rle_decoder::compressed
Next bytes represent compressed data.
Definition: rle_decoder.hpp:79
claw::rle_decoder::m_pattern
pattern_type m_pattern
The pattern to repeat.
Definition: rle_decoder.hpp:104
claw::rle_decoder::pattern_type
Pattern pattern_type
The type of the patterns we will read in the input buffer.
Definition: rle_decoder.hpp:58
claw::rle_decoder
A class to help decoding run-length encoded (RLE) streams.
Definition: rle_decoder.hpp:54
claw::rle_decoder::output_buffer_type
OutputBuffer output_buffer_type
The type of the output buffer.
Definition: rle_decoder.hpp:64
claw::rle_decoder::mode
mode
State of the decompression.
Definition: rle_decoder.hpp:70
claw::rle_decoder::input_buffer_type
InputBuffer input_buffer_type
The type of the input buffer.
Definition: rle_decoder.hpp:61
claw
This is the main namespace.
Definition: algorithm.hpp:33
claw::rle_decoder::raw
Next bytes represent raw data.
Definition: rle_decoder.hpp:76
claw::rle_decoder::m_count
unsigned int m_count
Case of m_mode :
Definition: rle_decoder.hpp:101
claw::rle_decoder::stop
Stop the decoding.
Definition: rle_decoder.hpp:73