112 unsigned char *p = s;
175 typename std::enable_if<std::is_same<T,size_t>::value,T>::type* =
nullptr
201 void write(
const char *buf,
size_t len)
237 void str(
const std::string &s)
270 n =
static_cast<uint32_t
>(-
static_cast<int32_t
>(n));
272 do { *--p = (
static_cast<char>(n%10)) +
'0'; n /= 10; }
while ( n );
273 if ( neg ) *--p =
'-';
279 snprintf(buf,64,
"%f",d);
283 std::ostream *
m_s =
nullptr;
This is an alternative implementation of QCString.
const std::string & str() const
Text streaming class that buffers data.
bool empty() const
Returns true iff the buffer is empty.
TextStream & operator<<(unsigned char *s)
Adds an unsigned character string to the stream.
void setStream(std::ostream *s)
Sets or changes the std::ostream to write to.
std::ostream * stream() const
Returns the attached std::ostream object.
TextStream & operator<<(const std::string &s)
Adds a std::string to the stream.
void output_double(double d)
TextStream & operator<<(float f)
Adds a float to the stream.
TextStream & operator<<(unsigned short i)
Adds a unsigned short integer to the stream.
void output_int32(uint32_t n, bool neg)
Writes a string representation of an integer to the buffer.
TextStream & operator<<(signed int i)
Adds a signed integer to the stream.
TextStream & operator<<(double d)
Adds a double to the stream.
TextStream & operator<<(T i)
Adds a size_t integer to the stream.
TextStream(const std::string &s)
Create a text stream, initializing the buffer with string s.
void str(const std::string &s)
Sets the buffer's contents to string s.
TextStream & operator<<(const QCString &s)
Adds a QCString to the stream.
TextStream & operator<<(signed short i)
Adds a signed short integer to the stream.
TextStream & operator<<(const char *s)
Adds a C-style string to the stream.
void flush()
Flushes the buffer.
TextStream(std::ostream *s)
Create a text stream object for writing to a std::ostream.
void write(const char *buf, size_t len)
Adds a array of character to the stream.
~TextStream()
Writes any data that is buffered to the attached std::ostream.
std::string str() const
Return the contents of the buffer as a std::string object.
void str(const char *s)
Sets the buffer's contents to string s Any data already in the buffer will be flushed.
TextStream(size_t capacity=INITIAL_CAPACITY)
Creates an empty stream object.
static const int INITIAL_CAPACITY
TextStream & operator<<(unsigned char c)
Adds an unsigned character to the stream.
TextStream & operator<<(char c)
Adds a character to the stream.
void clear()
Clears any buffered data.
TextStream & operator<<(unsigned int i)
Adds a unsigned integer to the stream.
#define ONLY_DEFAULT_MOVABLE(cls)
Macro to help implementing the rule of 5 for a class that can be moved but not copied.