add:添加get_len接口。
This commit is contained in:
parent
79e086bae5
commit
0f7a8d3c92
@ -4,6 +4,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ public:
|
|||||||
void push(const char* data, int len);
|
void push(const char* data, int len);
|
||||||
int index_of(const char* data, int len, int start_pos = 0);
|
int index_of(const char* data, int len, int start_pos = 0);
|
||||||
const char* get_data() const;
|
const char* get_data() const;
|
||||||
|
int get_len() const;
|
||||||
void remove_of(int start_pos, int len);
|
void remove_of(int start_pos, int len);
|
||||||
void clear();
|
void clear();
|
||||||
private:
|
private:
|
||||||
|
@ -33,6 +33,11 @@ const char* CMutBuffer::get_data() const
|
|||||||
return buffer_.data();
|
return buffer_.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CMutBuffer::get_len() const
|
||||||
|
{
|
||||||
|
return static_cast<int>(buffer_.size());
|
||||||
|
}
|
||||||
|
|
||||||
void CMutBuffer::clear()
|
void CMutBuffer::clear()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user