-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathCCIBufferReader.h
77 lines (54 loc) · 1.88 KB
/
CCIBufferReader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// CCIBufferReader.h
// CocosInterpreterTest
//
// Created by Wu Tong on 13-4-8.
//
//
#ifndef __CocosInterpreterTest__CCIBufferReader__
#define __CocosInterpreterTest__CCIBufferReader__
#include <iostream>
#include "CCITypes.h"
NS_CC_EXT_BEGIN
class CCIBufferReader{
public:
ByteVector mData;
int mDataBitSize;
mutable int mReadBitPos;
mutable int mWriteBitPos;
mutable int mTagPos;
mutable bool mReachEnd;
public:
CCIBufferReader();
virtual ~CCIBufferReader();
void setData(uint8_t* thePtr, int theCount);
UI8 * getDataPtr();
int getDataLen() const;
void clear();
UI8 readUI8() const;
UI16 readUI16() const;
UI32 readUI32() const;
FLOAT16 readFLOAT16() const;
FLOAT readFLOAT() const;
int readSBits(UI32 nbits);
UI32 readUBits(UI32 nbits);
float readFBits(UI32 nbits);
void clearBits();
UI8 scanUBits(UI32 nbits);
UI8 scanUI8() const;
std::string readString() const;
UI8 * readBytes(UI32 byte) const;
FIXED readFIXED() const;
FIXED8 readFIXED8() const;
void skipBytes(UI32 byte) const;
void begin(int length);
bool isTagFinished();
void flush();
int version;
int tagType;
private:
UI8 mLeftByte;
UI32 mLeftNbits;
};
NS_CC_EXT_END
#endif /* defined(__CocosInterpreterTest__CCIBufferReader__) */