libnative-utilities/include/utils/BitReader.hpp
2024-08-15 18:40:30 +08:00

49 lines
1005 B
C++

#ifndef BYTEREADER_HPP
#define BYTEREADER_HPP
class BitReader{
public:
BitReader(const char* dataArray, unsigned int arrayLength);
~BitReader();
unsigned char getBitsFromArray(unsigned int count);
char* getFixedDepthBitsFromArray(unsigned int bitDepth, unsigned count);
unsigned long long int getBitIndex();
unsigned int getBitIndexOfCurrentByte();
unsigned int getByteIndex();
void setBitIndex(unsigned long long int index);
void setBitIndexOfCurrentByte(unsigned int index);
void setByteIndex(unsigned int);
unsigned int isEOA();
static unsigned char getBitsFromByte(unsigned char byte, unsigned int count);
static unsigned char getBitsFromByte(unsigned char byte, unsigned int index, unsigned int count);
private:
unsigned int page;
unsigned int currentBitCursor;
unsigned int arrlen=0;
char* array;
BitReader(void);
};
#endif // BYTEREADER_HPP