缓冲区,表示内存中一块2进制数据(利用malloc/realloc进行内存分配)
更多...
#include <utilities.hpp>
|
| Buffer () |
| 默认构造函数 更多...
|
|
| Buffer (void *buf, uint size, bool isPeek=false) |
| 构造函数1 从一个缓冲区创建Buffer,可以指定是否为窥视模式 更多...
|
|
| Buffer (AnsiString const &data, bool isPeek=false) |
| 构造函数2 从一个AnsiString创建Buffer,可以指定是否为窥视模式 更多...
|
|
virtual | ~Buffer () |
|
| Buffer (Buffer const &other) |
|
Buffer & | operator= (Buffer const &other) |
|
| Buffer (Buffer &&other) |
| 移动构造函数 更多...
|
|
Buffer & | operator= (Buffer &&other) |
| 移动赋值操作 更多...
|
|
| Buffer (GrowBuffer &&other) |
| 移动构造函数1 更多...
|
|
Buffer & | operator= (GrowBuffer &&other) |
| 移动赋值操作1 更多...
|
|
void | setBuf (void *buf, uint size, uint capacity, bool isPeek) |
| 设置缓冲区,当isPeek为false时拷贝数据缓冲区 更多...
|
|
void | setBuf (void *buf, uint size, bool isPeek) |
| 设置缓冲区,当isPeek为false时拷贝数据缓冲区 更多...
|
|
void | alloc (uint capacity, bool setDataSize=true) |
| 分配容量大小,当setDataSize为true时设置数据长度 更多...
|
|
void | realloc (uint newCapacity) |
| 重新调整容量的大小,保留数据内容 更多...
|
|
bool | peekCopy (bool copyCapacity=false) |
| 把窥探模式变为拷贝模式,如果copyCapacity为true时连容量也一起拷贝,否则只拷贝数据。 更多...
|
|
void | free () |
| 释放缓冲区 更多...
|
|
void * | getBuf () const |
| 暴露缓冲区指针 更多...
|
|
template<typename _Ty > |
_Ty * | getBuf () const |
|
winux::byte & | operator[] (int i) |
|
winux::byte const & | operator[] (int i) const |
|
uint | getSize () const |
| 获取数据大小 更多...
|
|
void | _setSize (uint dataSize) |
| 设置数据大小,不能超过容量大小(不建议外部调用) 更多...
|
|
uint | getCapacity () const |
| 获取容量大小 更多...
|
|
| operator bool () const |
| 判断是否为一个有效的Buffer 更多...
|
|
template<typename _ChTy > |
std::basic_string< _ChTy > | toString () const |
| 转换到字符串 更多...
|
|
AnsiString | toAnsi () const |
| 转换到AnsiString 更多...
|
|
UnicodeString | toUnicode () const |
| 转换到UnicodeString 更多...
|
|
缓冲区,表示内存中一块2进制数据(利用malloc/realloc进行内存分配)
在文件 utilities.hpp 第 436 行定义.
winux::Buffer::Buffer |
( |
| ) |
|
winux::Buffer::Buffer |
( |
void * |
buf, |
|
|
uint |
size, |
|
|
bool |
isPeek = false |
|
) |
| |
构造函数1 从一个缓冲区创建Buffer,可以指定是否为窥视模式
处于窥视模式时将不负责管理资源的释放
winux::Buffer::Buffer |
( |
AnsiString const & |
data, |
|
|
bool |
isPeek = false |
|
) |
| |
构造函数2 从一个AnsiString创建Buffer,可以指定是否为窥视模式
处于窥视模式时将不负责管理资源的释放
virtual winux::Buffer::~Buffer |
( |
| ) |
|
|
virtual |
winux::Buffer::Buffer |
( |
Buffer const & |
other | ) |
|
winux::Buffer::Buffer |
( |
Buffer && |
other | ) |
|
static void* winux::Buffer::_Alloc |
( |
uint |
size | ) |
|
|
staticprotected |
static void winux::Buffer::_Free |
( |
void * |
p | ) |
|
|
staticprotected |
static void* winux::Buffer::_Realloc |
( |
void * |
p, |
|
|
uint |
newSize |
|
) |
| |
|
staticprotected |
void winux::Buffer::_setSize |
( |
uint |
dataSize | ) |
|
|
inline |
void winux::Buffer::alloc |
( |
uint |
capacity, |
|
|
bool |
setDataSize = true |
|
) |
| |
分配容量大小,当setDataSize为true时设置数据长度
void winux::Buffer::free |
( |
| ) |
|
void* winux::Buffer::getBuf |
( |
| ) |
const |
|
inline |
template<typename _Ty >
_Ty* winux::Buffer::getBuf |
( |
| ) |
const |
|
inline |
uint winux::Buffer::getCapacity |
( |
| ) |
const |
|
inline |
uint winux::Buffer::getSize |
( |
| ) |
const |
|
inline |
winux::Buffer::operator bool |
( |
| ) |
const |
|
inline |
winux::byte const& winux::Buffer::operator[] |
( |
int |
i | ) |
const |
|
inline |
bool winux::Buffer::peekCopy |
( |
bool |
copyCapacity = false | ) |
|
把窥探模式变为拷贝模式,如果copyCapacity为true时连容量也一起拷贝,否则只拷贝数据。
void winux::Buffer::realloc |
( |
uint |
newCapacity | ) |
|
重新调整容量的大小,保留数据内容
如果新的容量小于数据大小,多余的数据被丢弃
void winux::Buffer::setBuf |
( |
void * |
buf, |
|
|
uint |
size, |
|
|
uint |
capacity, |
|
|
bool |
isPeek |
|
) |
| |
设置缓冲区,当isPeek为false时拷贝数据缓冲区
void winux::Buffer::setBuf |
( |
void * |
buf, |
|
|
uint |
size, |
|
|
bool |
isPeek |
|
) |
| |
|
inline |
template<typename _ChTy >
std::basic_string<_ChTy> winux::Buffer::toString |
( |
| ) |
const |
|
inline |
void* winux::Buffer::_buf |
|
protected |
uint winux::Buffer::_capacity |
|
protected |
uint winux::Buffer::_dataSize |
|
protected |
bool winux::Buffer::_isPeek |
|
protected |
该类的文档由以下文件生成: