fastdo  0.5.12
winux::Buffer类 参考

缓冲区,表示内存中一块2进制数据(利用malloc/realloc进行内存分配) 更多...

#include <utilities.hpp>

类 winux::Buffer 继承关系图:

Public 成员函数

 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)
 
Bufferoperator= (Buffer const &other)
 
 Buffer (Buffer &&other)
 移动构造函数 更多...
 
Bufferoperator= (Buffer &&other)
 移动赋值操作 更多...
 
 Buffer (GrowBuffer &&other)
 移动构造函数1 更多...
 
Bufferoperator= (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::byteoperator[] (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 更多...
 

静态 Protected 成员函数

static void * _Alloc (uint size)
 
static void * _Realloc (void *p, uint newSize)
 
static void _Free (void *p)
 

Protected 属性

void * _buf
 
uint _dataSize
 
uint _capacity
 
bool _isPeek
 

友元

class GrowBuffer
 

详细描述

缓冲区,表示内存中一块2进制数据(利用malloc/realloc进行内存分配)

在文件 utilities.hpp436 行定义.

构造及析构函数说明

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)

移动构造函数

winux::Buffer::Buffer ( GrowBuffer &&  other)

移动构造函数1

成员函数说明

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

设置数据大小,不能超过容量大小(不建议外部调用)

在文件 utilities.hpp497 行定义.

void winux::Buffer::alloc ( uint  capacity,
bool  setDataSize = true 
)

分配容量大小,当setDataSize为true时设置数据长度

void winux::Buffer::free ( )

释放缓冲区

void* winux::Buffer::getBuf ( ) const
inline

暴露缓冲区指针

在文件 utilities.hpp485 行定义.

template<typename _Ty >
_Ty* winux::Buffer::getBuf ( ) const
inline

在文件 utilities.hpp488 行定义.

uint winux::Buffer::getCapacity ( ) const
inline

获取容量大小

在文件 utilities.hpp500 行定义.

uint winux::Buffer::getSize ( ) const
inline

获取数据大小

在文件 utilities.hpp494 行定义.

winux::Buffer::operator bool ( ) const
inline

判断是否为一个有效的Buffer

在文件 utilities.hpp503 行定义.

Buffer& winux::Buffer::operator= ( Buffer const &  other)
Buffer& winux::Buffer::operator= ( Buffer &&  other)

移动赋值操作

Buffer& winux::Buffer::operator= ( GrowBuffer &&  other)

移动赋值操作1

winux::byte& winux::Buffer::operator[] ( int  i)
inline

在文件 utilities.hpp490 行定义.

winux::byte const& winux::Buffer::operator[] ( int  i) const
inline

在文件 utilities.hpp491 行定义.

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

设置缓冲区,当isPeek为false时拷贝数据缓冲区

在文件 utilities.hpp468 行定义.

函数调用图:

AnsiString winux::Buffer::toAnsi ( ) const
inline

转换到AnsiString

在文件 utilities.hpp513 行定义.

template<typename _ChTy >
std::basic_string<_ChTy> winux::Buffer::toString ( ) const
inline

转换到字符串

在文件 utilities.hpp507 行定义.

UnicodeString winux::Buffer::toUnicode ( ) const
inline

转换到UnicodeString

在文件 utilities.hpp515 行定义.

友元及相关函数文档

friend class GrowBuffer
friend

在文件 utilities.hpp527 行定义.

类成员变量说明

void* winux::Buffer::_buf
protected

在文件 utilities.hpp522 行定义.

uint winux::Buffer::_capacity
protected

在文件 utilities.hpp524 行定义.

uint winux::Buffer::_dataSize
protected

在文件 utilities.hpp523 行定义.

bool winux::Buffer::_isPeek
protected

在文件 utilities.hpp525 行定义.


该类的文档由以下文件生成: