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

Generated for libe-book by doxygen 1.8.8