RelayFile/Util/Util.h

40 lines
719 B
C++

#ifndef REMOTE_TRAN_UTIL
#define REMOTE_TRAN_UTIL
#include <mutex>
#include <vector>
#include <wx/wx.h>
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_;
};
class wxUtil
{
public:
static wxString GetConfigDir();
static bool CreateConfigDir(const wxString& dir, const wxString& name, wxString& fullPath);
};
#endif // REMOTE_TRAN_UTIL