EBOOKBitStream.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/*
3 * This file is part of the libe-book project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef EBOOKBITSTREAM_H_INCLUDED
11#define EBOOKBITSTREAM_H_INCLUDED
12
13#include "libebook_utils.h"
14
15
16 namespace libebook
17{
18
19 class EBOOKBitStream
20{
21 public:
22 explicit EBOOKBitStream(librevenge::RVNGInputStream *stream);
23
24 uint32_t read(uint8_t numberOfBits, bool bigEndian = false);
25
26 bool isEnd() const;
27 bool atLastByte() const;
28
29 private:
30 void fill();
31
36 uint8_t readByte();
37
45 uint8_t readBits(uint8_t numberOfBits);
46
47 uint8_t readAvailableBits(uint8_t numberOfBits);
48
49 private:
50 static const uint8_t s_masks[8];
51
52 private:
53 librevenge::RVNGInputStream *const m_stream;
54 uint8_t m_current;
55 uint8_t m_available;
56};
57
58}
59
60#endif // EBOOKBITSTREAM_H_INCLUDED
61
62/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
stream
RVNGInputStreamPtr_t stream
Definition HTMLHelpStream.cpp:79
libebook::EBOOKBitStream
Definition EBOOKBitStream.h:20
libebook::EBOOKBitStream::read
uint32_t read(uint8_t numberOfBits, bool bigEndian=false)
Definition EBOOKBitStream.cpp:28
libebook::EBOOKBitStream::isEnd
bool isEnd() const
Definition EBOOKBitStream.cpp:77
libebook::EBOOKBitStream::fill
void fill()
Definition EBOOKBitStream.cpp:91
libebook::EBOOKBitStream::m_stream
librevenge::RVNGInputStream *const m_stream
Definition EBOOKBitStream.h:53
libebook::EBOOKBitStream::s_masks
static const uint8_t s_masks[8]
Definition EBOOKBitStream.h:50
libebook::EBOOKBitStream::readByte
uint8_t readByte()
Reads a byte from the stream.
Definition EBOOKBitStream.cpp:101
libebook::EBOOKBitStream::readAvailableBits
uint8_t readAvailableBits(uint8_t numberOfBits)
Definition EBOOKBitStream.cpp:131
libebook::EBOOKBitStream::readBits
uint8_t readBits(uint8_t numberOfBits)
Reads a given amount of bits from the stream.
Definition EBOOKBitStream.cpp:106
libebook::EBOOKBitStream::m_available
uint8_t m_available
Definition EBOOKBitStream.h:55
libebook::EBOOKBitStream::atLastByte
bool atLastByte() const
Definition EBOOKBitStream.cpp:82
libebook::EBOOKBitStream::m_current
uint8_t m_current
Definition EBOOKBitStream.h:54
libebook_utils.h
libebook
Definition BBeBCollector.cpp:19