| 22 | const int WIRE_MAXVARINTBYTES = 10; |
| 23 | |
| 24 | class InputBuffer |
| 25 | { |
| 26 | public: |
| 27 | InputBuffer(); |
| 28 | InputBuffer(const char* buffer, uint32_t buffer_size); |
| 29 | |
| 30 | uint32_t Tell(); |
| 31 | void Seek(uint32_t pos); |
| 32 | bool Skip(uint32_t amount); |
| 33 | bool SubBuffer(uint32_t length, InputBuffer* sub_buffer); |
| 34 | bool Eof(); |
| 35 | |
| 36 | bool Read(int length, const char** buffer_out); |
| 37 | |
| 38 | bool ReadVarInt32(uint32_t* value); |
| 39 | bool ReadVarInt64(uint64_t* value); |
| 40 | bool ReadFixed32(uint32_t* value); |
| 41 | bool ReadFixed64(uint64_t* value); |
| 42 | |
| 43 | bool ReadFloat(float* value); |
| 44 | bool ReadDouble(double* value); |
| 45 | bool ReadInt32(int32_t* value); |
| 46 | bool ReadUInt32(uint32_t* value); |
| 47 | bool ReadInt64(int64_t* value); |
| 48 | bool ReadUInt64(uint64_t* value); |
| 49 | bool ReadBool(bool* value); |
| 50 | |
| 51 | private: |
| 52 | const char* m_Start; |
| 53 | const char* m_End; |
| 54 | const char* m_Current; |
| 55 | }; |
| 56 | } |
| 57 | |
| 58 | #endif // DDFINPUTSTREAM_H |