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
16namespace libebook
17{
18
20{
21public:
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
29private:
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
49private:
50 static const uint8_t s_masks[8];
51
52private:
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: */
RVNGInputStreamPtr_t stream
Definition HTMLHelpStream.cpp:79
Definition EBOOKBitStream.h:20
uint32_t read(uint8_t numberOfBits, bool bigEndian=false)
Definition EBOOKBitStream.cpp:28
bool isEnd() const
Definition EBOOKBitStream.cpp:77
void fill()
Definition EBOOKBitStream.cpp:91
librevenge::RVNGInputStream *const m_stream
Definition EBOOKBitStream.h:53
static const uint8_t s_masks[8]
Definition EBOOKBitStream.h:50
uint8_t readByte()
Reads a byte from the stream.
Definition EBOOKBitStream.cpp:101
uint8_t readAvailableBits(uint8_t numberOfBits)
Definition EBOOKBitStream.cpp:131
uint8_t readBits(uint8_t numberOfBits)
Reads a given amount of bits from the stream.
Definition EBOOKBitStream.cpp:106
uint8_t m_available
Definition EBOOKBitStream.h:55
bool atLastByte() const
Definition EBOOKBitStream.cpp:82
uint8_t m_current
Definition EBOOKBitStream.h:54
Definition BBeBCollector.cpp:19

Generated for libe-book by doxygen 1.9.7