32 lines
541 B
C
32 lines
541 B
C
|
#ifndef REMOTE_TRAN_UTIL
|
||
|
#define REMOTE_TRAN_UTIL
|
||
|
|
||
|
#include <mutex>
|
||
|
#include <vector>
|
||
|
|
||
|
constexpr int MAX_BUFFER_SIZE = 1024 * 1024 * 10;
|
||
|
|
||
|
class TranUtil
|
||
|
{
|
||
|
public:
|
||
|
TranUtil();
|
||
|
};
|
||
|
|
||
|
class MutBuffer
|
||
|
{
|
||
|
public:
|
||
|
MutBuffer() = default;
|
||
|
|
||
|
public:
|
||
|
void Push(const char* data, int len);
|
||
|
int IndexOf(const char* data, int len, int start_pos = 0);
|
||
|
const char* GetData() const;
|
||
|
int Length() const;
|
||
|
void RemoveOf(int start_pos, int len);
|
||
|
void Clear();
|
||
|
|
||
|
private:
|
||
|
std::vector<char> buffer_;
|
||
|
};
|
||
|
|
||
|
#endif // REMOTE_TRAN_UTIL
|