26 lines
475 B
C++
26 lines
475 B
C++
#ifndef GUTIL_H
|
|
#define GUTIL_H
|
|
|
|
#include <mutex>
|
|
#include <vector>
|
|
|
|
constexpr int MAX_BUFFER_SIZE = 1024 * 1024 * 10;
|
|
|
|
class CMutBuffer
|
|
{
|
|
public:
|
|
CMutBuffer() = default;
|
|
|
|
public:
|
|
void push(const char* data, int len);
|
|
int index_of(const char* data, int len, int start_pos = 0);
|
|
const char* get_data() const;
|
|
int get_len() const;
|
|
void remove_of(int start_pos, int len);
|
|
void clear();
|
|
|
|
private:
|
|
std::vector<char> buffer_;
|
|
};
|
|
|
|
#endif // GUTIL_H
|