Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef EBOOKBITSTREAM_H_INCLUDED
00018 #define EBOOKBITSTREAM_H_INCLUDED
00019
00020 #include "libebook_utils.h"
00021
00022 class WPXInputStream;
00023
00024 namespace libebook
00025 {
00026
00027 class EBOOKBitStream
00028 {
00029 public:
00030 explicit EBOOKBitStream(WPXInputStream *stream);
00031
00032 uint32_t read(uint8_t numberOfBits, bool bigEndian = false);
00033
00034 bool atEOS() const;
00035 bool atLastByte() const;
00036
00037 private:
00038 void fill();
00039
00044 uint8_t readByte();
00045
00053 uint8_t readBits(uint8_t numberOfBits);
00054
00055 uint8_t readAvailableBits(uint8_t numberOfBits);
00056
00057 private:
00058 static const uint8_t s_masks[8];
00059
00060 private:
00061 WPXInputStream *const m_stream;
00062 uint8_t m_current;
00063 uint8_t m_available;
00064 };
00065
00066 }
00067
00068 #endif // EBOOKBITSTREAM_H_INCLUDED
00069
00070