-
Notifications
You must be signed in to change notification settings - Fork 0
/
Buffer.h
executable file
·42 lines (37 loc) · 880 Bytes
/
Buffer.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
#include <string>
#include "string.h"
#include <stdint.h>
#ifndef BUFFER
#define BUFFER
struct Buffer{
uint8_t* buf;
uint8_t* bufstart;
int size;
int bufferSize;
int cur;
Buffer(char* buffer,int bufSize):size(0),bufferSize(bufSize),cur(0)
{
buf = bufstart = (uint8_t*)(buffer);
}
Buffer(char* buffer,int bufSize, int _size):size(_size),bufferSize(bufSize),cur(0)
{
buf = bufstart =(uint8_t*)(buffer);
}
void reset(int size = 0);
int getSize();
int getCurr();
uint8_t* getBuffer();
uint16_t getShort();
uint32_t getLong();
uint64_t getLongLong();
void consume(int n);
uint8_t getByte();
char* getRaw();
void append(uint16_t input);
void append(uint64_t input);
void append(uint32_t input);
void append(uint8_t input);
void appendLengthValue(std::string& input);
void getLengthValue(std::string& input);
};
#endif