Doxygen
TextStream类 参考final

Text streaming class that buffers data. 更多...

#include <textstream.h>

Public 成员函数

 TextStream ()
 Creates an empty stream object. 更多...
 
 TextStream (std::ostream *s)
 Create a text stream object for writing to a std::ostream. 更多...
 
 TextStream (const std::string &s)
 Create a text stream, initializing the buffer with string s 更多...
 
 ~TextStream ()
 Writes any data that is buffered to the attached std::ostream 更多...
 
 TextStream (const TextStream &)=delete
 
TextStreamoperator= (const TextStream &)=delete
 
void setStream (std::ostream *s)
 Sets or changes the std::ostream to write to. 更多...
 
void setFile (FILE *f)
 
std::ostream * stream () const
 Returns the attached std::ostream object. 更多...
 
FILE * file () const
 
TextStreamoperator<< (char c)
 Adds a character to the stream 更多...
 
TextStreamoperator<< (const char *s)
 Adds a C-style string to the stream 更多...
 
TextStreamoperator<< (const QCString &s)
 Adds a QCString to the stream 更多...
 
TextStreamoperator<< (const std::string &s)
 Adds a std::string to the stream 更多...
 
TextStreamoperator<< (signed short i)
 Adds a signed short integer to the stream 更多...
 
TextStreamoperator<< (unsigned short i)
 Adds a unsigned short integer to the stream 更多...
 
TextStreamoperator<< (signed int i)
 Adds a signed integer to the stream 更多...
 
TextStreamoperator<< (unsigned int i)
 Adds a unsigned integer to the stream 更多...
 
TextStreamoperator<< (float f)
 Adds a float to the stream 更多...
 
TextStreamoperator<< (double d)
 Adds a double to the stream 更多...
 
void write (const char *buf, size_t len)
 Adds a array of character to the stream 更多...
 
void flush ()
 Flushes the buffer. 更多...
 
void clear ()
 Clears any buffered data 更多...
 
std::string str () const
 Return the contents of the buffer as a std::string object 更多...
 
void str (const std::string &s)
 Sets the buffer's contents to string s. 更多...
 
void str (const char *s)
 Sets the buffer's contents to string s Any data already in the buffer will be flushed. 更多...
 
bool empty () const
 Returns true iff the buffer is empty 更多...
 

Private 成员函数

void output_int32 (uint32_t n, bool neg)
 Writes a string representation of an integer to the buffer 更多...
 
void output_double (double d)
 

Private 属性

std::string m_buffer
 
std::ostream * m_s = nullptr
 
FILE * m_f = nullptr
 

静态 Private 属性

static const int INITIAL_CAPACITY = 4096
 

详细描述

Text streaming class that buffers data.

Simpler version of std::ostringstream that has much better performance.

在文件 textstream.h33 行定义.

构造及析构函数说明

◆ TextStream() [1/4]

TextStream::TextStream ( )
inline

Creates an empty stream object.

在文件 textstream.h52 行定义.

52  : m_buffer(s)
53  {
54  m_buffer.reserve(s.length()+INITIAL_CAPACITY);
55  }

引用了 INITIAL_CAPACITY , 以及 m_buffer.

◆ TextStream() [2/4]

TextStream::TextStream ( std::ostream *  s)
inline

Create a text stream object for writing to a std::ostream.

注解
data is buffered until flush() is called or the object is destroyed.

在文件 textstream.h59 行定义.

◆ TextStream() [3/4]

TextStream::TextStream ( const std::string &  s)
inline

Create a text stream, initializing the buffer with string s

在文件 textstream.h65 行定义.

67  {
68  flush();

引用了 flush(), m_f , 以及 m_s.

◆ ~TextStream()

TextStream::~TextStream ( )
inline

Writes any data that is buffered to the attached std::ostream

在文件 textstream.h71 行定义.

74 {

◆ TextStream() [4/4]

TextStream::TextStream ( const TextStream )
delete

成员函数说明

◆ clear()

void TextStream::clear ( )
inline

Clears any buffered data

在文件 textstream.h202 行定义.

204  {
205  flush();

引用了 flush() , 以及 m_buffer.

◆ empty()

bool TextStream::empty ( ) const
inline

Returns true iff the buffer is empty

在文件 textstream.h232 行定义.

235  {

被这些函数引用 HtmlGenerator::endClassDiagram(), ClassContext::Private::inheritanceDiagram(), insertMapFile(), DotFilePatcher::run() , 以及 writeDotImageMapFromFile().

◆ file()

FILE* TextStream::file ( ) const
inline

在文件 textstream.h101 行定义.

102  {
103  if (s) m_buffer+=s;
104  return static_cast<TextStream&>(*this);

引用了 m_buffer.

被这些函数引用 TextGeneratorOLImpl::writeLink().

◆ flush()

void TextStream::flush ( )
inline

Flushes the buffer.

If a std::ostream is attached, the buffer's contents will be written to the stream.

在文件 textstream.h188 行定义.

190  {
191  m_buffer.clear();
192  }
193 
194  /** Return the contents of the buffer as a std::string object */
195  std::string str() const
196  {
197  return m_buffer;
198  }
199 

引用了 m_buffer.

被这些函数引用 clear(), OutputGenerator::endPlainFile(), FormulaManager::generateImages(), RTFGenerator::preProcessFileInplace(), TemplateNodeMsg::render(), DotFilePatcher::run(), str(), TextStream(), FlowChart::writeFlowChart() , 以及 VhdlDocGen::writeOverview().

◆ operator<<() [1/10]

TextStream& TextStream::operator<< ( char  c)
inline

Adds a character to the stream

在文件 textstream.h107 行定义.

109  {
110  m_buffer+=s.str();
111  return static_cast<TextStream&>(*this);

引用了 m_buffer , 以及 QCString::str().

◆ operator<<() [2/10]

TextStream& TextStream::operator<< ( const char *  s)
inline

Adds a C-style string to the stream

在文件 textstream.h114 行定义.

116  {
117  m_buffer+=s;
118  return static_cast<TextStream&>(*this);

引用了 m_buffer.

◆ operator<<() [3/10]

TextStream& TextStream::operator<< ( const QCString s)
inline

Adds a QCString to the stream

在文件 textstream.h121 行定义.

123  {
124  output_int32(i,i<0);
125  return static_cast<TextStream&>(*this);

引用了 output_int32().

◆ operator<<() [4/10]

TextStream& TextStream::operator<< ( const std::string &  s)
inline

Adds a std::string to the stream

在文件 textstream.h128 行定义.

130  {
131  output_int32(i,false);
132  return static_cast<TextStream&>(*this);

引用了 output_int32().

◆ operator<<() [5/10]

TextStream& TextStream::operator<< ( double  d)
inline

Adds a double to the stream

在文件 textstream.h170 行定义.

176  {

◆ operator<<() [6/10]

TextStream& TextStream::operator<< ( float  f)
inline

Adds a float to the stream

在文件 textstream.h163 行定义.

168  {

引用了 m_buffer.

◆ operator<<() [7/10]

TextStream& TextStream::operator<< ( signed int  i)
inline

Adds a signed integer to the stream

在文件 textstream.h149 行定义.

151  {
152  output_double((double)f);
153  return static_cast<TextStream&>(*this);

引用了 output_double().

◆ operator<<() [8/10]

TextStream& TextStream::operator<< ( signed short  i)
inline

Adds a signed short integer to the stream

在文件 textstream.h135 行定义.

137  {
138  output_int32(i,i<0);
139  return static_cast<TextStream&>(*this);

引用了 output_int32().

◆ operator<<() [9/10]

TextStream& TextStream::operator<< ( unsigned int  i)
inline

Adds a unsigned integer to the stream

在文件 textstream.h156 行定义.

158  {
159  output_double(d);
160  return static_cast<TextStream&>(*this);

引用了 output_double().

◆ operator<<() [10/10]

TextStream& TextStream::operator<< ( unsigned short  i)
inline

Adds a unsigned short integer to the stream

在文件 textstream.h142 行定义.

144  {
145  output_int32(i,false);
146  return static_cast<TextStream&>(*this);

引用了 output_int32().

◆ operator=()

TextStream& TextStream::operator= ( const TextStream )
delete

◆ output_double()

void TextStream::output_double ( double  d)
inlineprivate

在文件 textstream.h255 行定义.

被这些函数引用 operator<<().

◆ output_int32()

void TextStream::output_int32 ( uint32_t  n,
bool  neg 
)
inlineprivate

Writes a string representation of an integer to the buffer

参数
nthe absolute value of the integer
negindicates if the integer is negative

在文件 textstream.h242 行定义.

243  {
244  char buf[64];
245  snprintf(buf,64,"%f",d);
246  m_buffer+=buf;
247  }
248  std::string m_buffer;
249  std::ostream *m_s = nullptr;
250  FILE *m_f = nullptr;
251 };
252 
253 #endif

引用了 m_buffer.

被这些函数引用 operator<<().

◆ setFile()

void TextStream::setFile ( FILE *  f)
inline

在文件 textstream.h86 行定义.

89  {
90  return m_f;
91  }

被这些函数引用 OutputGenerator::startPlainFile().

◆ setStream()

void TextStream::setStream ( std::ostream *  s)
inline

Sets or changes the std::ostream to write to.

注解
Any data already buffered will be flushed.

在文件 textstream.h79 行定义.

84  {

引用了 m_s.

被这些函数引用 OutputGenerator::endPlainFile() , 以及 DotFilePatcher::run().

◆ str() [1/3]

std::string TextStream::str ( ) const
inline

Return the contents of the buffer as a std::string object

在文件 textstream.h208 行定义.

213  {

引用了 flush() , 以及 m_buffer.

被这些函数引用 addConceptToContext(), addEnumValuesToEnums(), addMemberDocs(), addVariableToClass(), addVariableToFile(), MemberContext::Private::callerGraph(), MemberContext::Private::callGraph(), ClassContext::Private::collaborationDiagram(), DotGraph::computeGraph(), DotGroupCollaboration::computeTheGraph(), DotLegendGraph::computeTheGraph(), DotGfxHierarchyTable::computeTheGraph(), DotDirDeps::computeTheGraph(), convertToLaTeX(), InheritanceGraphContext::Private::createGraph(), createLinkedText(), DirContext::Private::dirGraph(), QhpXmlWriter::dumpTo(), HtmlGenerator::endClassDiagram(), Entry::Entry(), escapeCommas(), getMscImageMapFromFile(), getSearchBox(), ModuleContext::Private::groupGraph(), FileContext::Private::includedByGraph(), FileContext::Private::includeGraph(), ClassContext::Private::inheritanceDiagram(), QhpXmlWriter::insert(), insertMapFile(), latexEscapeIndexChars(), latexEscapeLabelName(), latexEscapePDFString(), latexFilterURL(), parseCode(), parseCommentAsText(), parseDoc(), LatexSpaceless::remove(), HtmlSpaceless::remove(), removeAnonymousScopes(), TemplateNodeBlock::render(), TemplateNodeCreate::render(), TemplateNodeTree::renderChildren(), Entry::reset(), DotFilePatcher::run(), searchId(), stripIndentation(), substituteLatexKeywords(), templateSpec(), writeAnnotatedIndexGeneric(), writeConceptIndex(), ConceptDefImpl::writeDefinition(), writeDotImageMapFromFile(), writeFileIndex(), writeGroupIndex(), writeHierarchicalExceptionIndex(), writeHierarchicalIndex(), writeHierarchicalInterfaceIndex(), writeNamespaceIndex() , 以及 writePageIndex().

◆ str() [2/3]

void TextStream::str ( const char *  s)
inline

Sets the buffer's contents to string s Any data already in the buffer will be flushed.

在文件 textstream.h225 行定义.

230  {

◆ str() [3/3]

void TextStream::str ( const std::string &  s)
inline

Sets the buffer's contents to string s.

Any data already in the buffer will be flushed.

在文件 textstream.h216 行定义.

220  {

◆ stream()

std::ostream* TextStream::stream ( ) const
inline

Returns the attached std::ostream object.

参见
setStream()

在文件 textstream.h96 行定义.

102  {

被这些函数引用 OutputGenerator::operator=() , 以及 OutputGenerator::OutputGenerator().

◆ write()

void TextStream::write ( const char *  buf,
size_t  len 
)
inline

Adds a array of character to the stream

参数
bufthe character buffer
lenthe number of characters in the buffer to write

在文件 textstream.h180 行定义.

182  {
183  fwrite(m_buffer.c_str(),1,m_buffer.length(),m_f);

被这些函数引用 DotGfxHierarchyTable::computeTheGraph(), generateXML() , 以及 writeUTF8Char().

类成员变量说明

◆ INITIAL_CAPACITY

const int TextStream::INITIAL_CAPACITY = 4096
staticprivate

在文件 textstream.h48 行定义.

被这些函数引用 TextStream().

◆ m_buffer

std::string TextStream::m_buffer
private

在文件 textstream.h261 行定义.

被这些函数引用 clear(), file(), flush(), operator<<(), output_int32(), str() , 以及 TextStream().

◆ m_f

FILE* TextStream::m_f = nullptr
private

在文件 textstream.h263 行定义.

被这些函数引用 TextStream().

◆ m_s

std::ostream* TextStream::m_s = nullptr
private

在文件 textstream.h262 行定义.

被这些函数引用 setStream() , 以及 TextStream().


该类的文档由以下文件生成:
TextStream::output_int32
void output_int32(uint32_t n, bool neg)
Writes a string representation of an integer to the buffer
Definition: textstream.h:242
TextStream::m_f
FILE * m_f
Definition: textstream.h:263
TextStream::m_buffer
std::string m_buffer
Definition: textstream.h:261
TextStream
Text streaming class that buffers data.
Definition: textstream.h:33
TextStream::flush
void flush()
Flushes the buffer.
Definition: textstream.h:188
TextStream::INITIAL_CAPACITY
static const int INITIAL_CAPACITY
Definition: textstream.h:48
TextStream::m_s
std::ostream * m_s
Definition: textstream.h:262
TextStream::str
std::string str() const
Return the contents of the buffer as a std::string object
Definition: textstream.h:208
TextStream::output_double
void output_double(double d)
Definition: textstream.h:255