Doxygen
BufStr类 参考

Buffer used to store strings 更多...

#include <bufstr.h>

Public 成员函数

 BufStr (uint size)
 
 ~BufStr ()
 
void addChar (char c)
 
void addArray (const char *a, uint len)
 
void skip (uint s)
 
void shrink (uint newlen)
 
void resize (uint newlen)
 
uint size () const
 
char * data () const
 
char & at (uint i) const
 
bool isEmpty () const
 
 operator const char * () const
 
uint curPos () const
 
void dropFromStart (uint bytes)
 

Private 成员函数

void makeRoomFor (uint size)
 

Private 属性

uint m_size
 
uint m_writeOffset
 
const uint m_spareRoom
 
char * m_buf
 

详细描述

Buffer used to store strings

This buffer is used append characters and strings. It will automatically resize itself, yet provide efficient random access to the content.

在文件 bufstr.h 第 29 行定义.

构造及析构函数说明

◆ BufStr()

BufStr::BufStr ( uint  size)
inline

在文件 bufstr.h 第 48 行定义.

53  {

◆ ~BufStr()

BufStr::~BufStr ( )
inline

在文件 bufstr.h 第 53 行定义.

53  {
54  makeRoomFor(s);
55  m_writeOffset+=s;
56  }

引用了 m_writeOffset , 以及 makeRoomFor().

成员函数说明

◆ addArray()

void BufStr::addArray ( const char *  a,
uint  len 
)
inline

在文件 bufstr.h 第 62 行定义.

63  {
64  uint oldsize = m_size;
65  m_size=newlen;
66  if (m_writeOffset>=m_size) // offset out of range -> enlarge
67  {

引用了 m_size , 以及 m_writeOffset.

被这些函数引用 FilterCache::getFileContents() , 以及 readInputFile().

◆ addChar()

void BufStr::addChar ( char  c)
inline

在文件 bufstr.h 第 57 行定义.

58  {
59  m_writeOffset=newlen;
60  resize(newlen);
61  }

引用了 m_writeOffset , 以及 resize().

被这些函数引用 fileToString(), FilterCache::getFileContents(), parseFile(), readInputFile() , 以及 removeEmptyLines().

◆ at()

char& BufStr::at ( uint  i) const
inline

在文件 bufstr.h 第 100 行定义.

101  {
102  if (bytes>m_size) bytes=m_size;
103  if (bytes>0) qmemmove(m_buf,m_buf+bytes,m_size-bytes);

引用了 m_buf, m_size , 以及 qmemmove().

被这些函数引用 fileToString() , 以及 readInputFile().

◆ curPos()

uint BufStr::curPos ( ) const
inline

在文件 bufstr.h 第 112 行定义.

被这些函数引用 parseFile() , 以及 readInputFile().

◆ data()

char* BufStr::data ( ) const
inline

在文件 bufstr.h 第 96 行定义.

97  {
98  return m_writeOffset;
99  }

引用了 m_writeOffset.

被这些函数引用 fileToString(), FilterCache::getFileContents(), parseFile(), readCodeFragment(), readInputFile(), removeEmptyLines() , 以及 transcodeCharacterBuffer().

◆ dropFromStart()

void BufStr::dropFromStart ( uint  bytes)
inline

在文件 bufstr.h 第 116 行定义.

被这些函数引用 readInputFile().

◆ isEmpty()

bool BufStr::isEmpty ( ) const
inline

在文件 bufstr.h 第 104 行定义.

107  :
108  void makeRoomFor(uint size)

◆ makeRoomFor()

void BufStr::makeRoomFor ( uint  size)
inlineprivate

在文件 bufstr.h 第 124 行定义.

被这些函数引用 ~BufStr().

◆ operator const char *()

BufStr::operator const char * ( ) const
inline

在文件 bufstr.h 第 108 行定义.

109  {
111  {

引用了 m_size, m_writeOffset , 以及 size().

◆ resize()

void BufStr::resize ( uint  newlen)
inline

在文件 bufstr.h 第 78 行定义.

81  {
82  return m_buf;
83  }
84  char &at(uint i) const
85  {
86  return m_buf[i];
87  }
88  bool isEmpty() const
89  {
90  return m_writeOffset==0;
91  }

被这些函数引用 addChar() , 以及 FilterCache::getFileContents().

◆ shrink()

void BufStr::shrink ( uint  newlen)
inline

在文件 bufstr.h 第 73 行定义.

77  {

被这些函数引用 readInputFile() , 以及 transcodeCharacterBuffer().

◆ size()

uint BufStr::size ( ) const
inline

在文件 bufstr.h 第 92 行定义.

93  {
94  return m_buf;
95  }

引用了 m_buf.

被这些函数引用 fileToString() , 以及 operator const char *().

◆ skip()

void BufStr::skip ( uint  s)
inline

在文件 bufstr.h 第 68 行定义.

72  {

被这些函数引用 readInputFile().

类成员变量说明

◆ m_buf

char* BufStr::m_buf
private

在文件 bufstr.h 第 134 行定义.

被这些函数引用 at() , 以及 size().

◆ m_size

uint BufStr::m_size
private

在文件 bufstr.h 第 131 行定义.

被这些函数引用 addArray(), at() , 以及 operator const char *().

◆ m_spareRoom

const uint BufStr::m_spareRoom
private

在文件 bufstr.h 第 133 行定义.

◆ m_writeOffset

uint BufStr::m_writeOffset
private

在文件 bufstr.h 第 132 行定义.

被这些函数引用 addArray(), addChar(), data(), operator const char *() , 以及 ~BufStr().


该类的文档由以下文件生成:
BufStr::at
char & at(uint i) const
Definition: bufstr.h:100
BufStr::m_buf
char * m_buf
Definition: bufstr.h:134
uint
unsigned uint
Definition: qcstring.h:40
BufStr::size
uint size() const
Definition: bufstr.h:92
BufStr::makeRoomFor
void makeRoomFor(uint size)
Definition: bufstr.h:124
BufStr::isEmpty
bool isEmpty() const
Definition: bufstr.h:104
BufStr::m_size
uint m_size
Definition: bufstr.h:131
BufStr::m_writeOffset
uint m_writeOffset
Definition: bufstr.h:132
BufStr::resize
void resize(uint newlen)
Definition: bufstr.h:78
qmemmove
void * qmemmove(void *dst, const void *src, size_t len)
Definition: qcstring.cpp:397