bitz-server  2.0.1
Public Member Functions | Protected Member Functions | Friends | List of all members
fmt::BasicWriter< Char > Class Template Reference

#include <format.h>

Inheritance diagram for fmt::BasicWriter< Char >:
fmt::BasicArrayWriter< Char > fmt::BasicMemoryWriter< Char, Allocator >

Public Member Functions

virtual ~BasicWriter ()
 
std::size_t size () const
 
const Char * data () const FMT_NOEXCEPT
 
const Char * c_str () const
 
std::basic_string< Char > str () const
 
void write (BasicCStringRef< Char > format, ArgList args)
 
BasicWriteroperator<< (int value)
 
BasicWriteroperator<< (unsigned value)
 
BasicWriteroperator<< (long value)
 
BasicWriteroperator<< (unsigned long value)
 
BasicWriteroperator<< (LongLong value)
 
BasicWriteroperator<< (ULongLong value)
 
BasicWriteroperator<< (double value)
 
BasicWriteroperator<< (long double value)
 
BasicWriteroperator<< (char value)
 
BasicWriteroperator<< (typename internal::WCharHelper< wchar_t, Char >::Supported value)
 
BasicWriteroperator<< (fmt::BasicStringRef< Char > value)
 
BasicWriteroperator<< (typename internal::WCharHelper< StringRef, Char >::Supported value)
 
template<typename T , typename Spec , typename FillChar >
BasicWriteroperator<< (IntFormatSpec< T, Spec, FillChar > spec)
 
template<typename StrChar >
BasicWriteroperator<< (const StrFormatSpec< StrChar > &spec)
 
void clear () FMT_NOEXCEPT
 
Buffer< Char > & buffer () FMT_NOEXCEPT
 

Protected Member Functions

 BasicWriter (Buffer< Char > &b)
 

Friends

template<typename Impl , typename Char_ , typename Spec_ >
class internal::ArgFormatterBase
 
template<typename Impl , typename Char_ , typename Spec_ >
class BasicPrintfArgFormatter
 

Detailed Description

template<typename Char>
class fmt::BasicWriter< Char >

This template provides operations for formatting and writing data into a character stream. The output is stored in a buffer provided by a subclass such as :class:fmt::BasicMemoryWriter.

You can use one of the following typedefs for common character types:

+------—+-------------------—+ | Type | Definition | +=========+======================+ | Writer | BasicWriter<char> | +------—+-------------------—+ | WWriter | BasicWriter<wchar_t> | +------—+-------------------—+

Constructor & Destructor Documentation

◆ BasicWriter()

template<typename Char>
fmt::BasicWriter< Char >::BasicWriter ( Buffer< Char > &  b)
inlineexplicitprotected

Constructs a BasicWriter object.

◆ ~BasicWriter()

template<typename Char>
virtual fmt::BasicWriter< Char >::~BasicWriter ( )
inlinevirtual

Destroys a BasicWriter object.

Member Function Documentation

◆ c_str()

template<typename Char>
const Char* fmt::BasicWriter< Char >::c_str ( ) const
inline

Returns a pointer to the output buffer content with terminating null character appended.

◆ data()

template<typename Char>
const Char* fmt::BasicWriter< Char >::data ( ) const
inline

Returns a pointer to the output buffer content. No terminating null character is appended.

◆ operator<<() [1/4]

template<typename Char>
BasicWriter& fmt::BasicWriter< Char >::operator<< ( ULongLong  value)
inline

Formats value and writes it to the stream.

◆ operator<<() [2/4]

template<typename Char>
BasicWriter& fmt::BasicWriter< Char >::operator<< ( long double  value)
inline

Formats value using the general format for floating-point numbers ('g') and writes it to the stream.

◆ operator<<() [3/4]

template<typename Char>
BasicWriter& fmt::BasicWriter< Char >::operator<< ( char  value)
inline

Writes a character to the stream.

◆ operator<<() [4/4]

template<typename Char>
BasicWriter& fmt::BasicWriter< Char >::operator<< ( fmt::BasicStringRef< Char >  value)
inline

Writes value to the stream.

◆ size()

template<typename Char>
std::size_t fmt::BasicWriter< Char >::size ( ) const
inline

Returns the total number of characters written.

◆ str()

template<typename Char>
std::basic_string<Char> fmt::BasicWriter< Char >::str ( ) const
inline

Returns the content of the output buffer as an std::string.

◆ write()

template<typename Char>
void fmt::BasicWriter< Char >::write ( BasicCStringRef< Char >  format,
ArgList  args 
)
inline

Writes formatted data.

args* is an argument list representing arbitrary arguments.

Example**::

MemoryWriter out; out.write("Current point:\n"); out.write("({:+f}, {:+f})", -3.14, 3.14);

This will write the following output to the out object:

.. code-block:: none

Current point: (-3.140000, +3.140000)

The output can be accessed using :func:data(), :func:c_str or :func:str methods.

See also :ref:syntax.