doxygen
|
Text streaming class that buffers data. More...
#include <textstream.h>
Public Member Functions | |
TextStream (size_t capacity=INITIAL_CAPACITY) | |
Creates an empty stream object. | |
TextStream (std::ostream *s) | |
Create a text stream object for writing to a std::ostream. More... | |
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 | |
TextStream & | operator= (const TextStream &)=delete |
TextStream (TextStream &&)=default | |
TextStream & | operator= (TextStream &&)=delete |
void | setStream (std::ostream *s) |
Sets or changes the std::ostream to write to. More... | |
void | setFile (FILE *f) |
std::ostream * | stream () const |
Returns the attached std::ostream object. More... | |
FILE * | file () const |
TextStream & | operator<< (char c) |
Adds a character to the stream. | |
TextStream & | operator<< (unsigned char c) |
Adds an unsigned character to the stream. | |
TextStream & | operator<< (unsigned char *s) |
Adds an unsigned character string to the stream. | |
TextStream & | operator<< (const char *s) |
Adds a C-style string to the stream. | |
TextStream & | operator<< (const QCString &s) |
Adds a QCString to the stream. | |
TextStream & | operator<< (const std::string &s) |
Adds a std::string to the stream. | |
TextStream & | operator<< (signed short i) |
Adds a signed short integer to the stream. | |
TextStream & | operator<< (unsigned short i) |
Adds a unsigned short integer to the stream. | |
TextStream & | operator<< (signed int i) |
Adds a signed integer to the stream. | |
TextStream & | operator<< (unsigned int i) |
Adds a unsigned integer to the stream. | |
template<typename T , typename std::enable_if< std::is_same< T, size_t >::value, T >::type * = nullptr> | |
TextStream & | operator<< (T i) |
Adds a size_t integer to the stream. More... | |
TextStream & | operator<< (float f) |
Adds a float to the stream. | |
TextStream & | operator<< (double d) |
Adds a double to the stream. | |
void | write (const char *buf, size_t len) |
Adds a array of character to the stream. More... | |
void | flush () |
Flushes the buffer. More... | |
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. More... | |
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. | |
Text streaming class that buffers data.
Simpler version of std::ostringstream that has much better performance.
|
inlineexplicit |
Create a text stream object for writing to a std::ostream.
|
inline |
Flushes the buffer.
If a std::ostream is attached, the buffer's contents will be written to the stream.
|
inline |
Adds a size_t integer to the stream.
We use SFINAE to avoid a compiler error in case size_t already matches the 'unsigned int' overload.
|
inline |
Sets or changes the std::ostream to write to.
|
inline |
Sets the buffer's contents to string s.
Any data already in the buffer will be flushed.
|
inline |
Returns the attached std::ostream object.
|
inline |
Adds a array of character to the stream.
buf | the character buffer |
len | the number of characters in the buffer to write |