Flow123d  JS_before_hm-2137-g84767e588
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
fmt::BasicWriter< Char > Class Template Reference

#include <format.h>

Inheritance diagram for fmt::BasicWriter< Char >:
Inheritance graph
[legend]
Collaboration diagram for fmt::BasicWriter< Char >:
Collaboration graph
[legend]

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)
 

Private Types

typedef internal::CharTraits< Char >::CharPtr CharPtr
 

Private Member Functions

 FMT_DISALLOW_COPY_AND_ASSIGN (BasicWriter)
 
CharPtr grow_buffer (std::size_t n)
 
template<typename UInt >
Char * write_unsigned_decimal (UInt value, unsigned prefix_size=0)
 
template<typename Int >
void write_decimal (Int value)
 
CharPtr prepare_int_buffer (unsigned num_digits, const EmptySpec &, const char *prefix, unsigned prefix_size)
 
template<typename Spec >
CharPtr prepare_int_buffer (unsigned num_digits, const Spec &spec, const char *prefix, unsigned prefix_size)
 
template<typename T , typename Spec >
void write_int (T value, Spec spec)
 
template<typename T >
void write_double (T value, const FormatSpec &spec)
 
template<typename StrChar >
CharPtr write_str (const StrChar *s, std::size_t size, const AlignSpec &spec)
 
template<typename StrChar >
void write_str (const internal::Arg::StringValue< StrChar > &str, const FormatSpec &spec)
 
void operator<< (typename internal::WCharHelper< wchar_t, Char >::Unsupported)
 
void operator<< (typename internal::WCharHelper< const wchar_t *, Char >::Unsupported)
 
void append_float_length (Char *&format_ptr, long double)
 
template<typename T >
void append_float_length (Char *&, T)
 

Static Private Member Functions

static Char * get (Char *p)
 
static CharPtr fill_padding (CharPtr buffer, unsigned total_size, std::size_t content_size, wchar_t fill)
 

Private Attributes

Buffer< Char > & buffer_
 

Friends

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

Detailed Description

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

\rst 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> | +------—+-------------------—+

\endrst

Definition at line 376 of file format.h.

Member Typedef Documentation

◆ CharPtr

template<typename Char >
typedef internal::CharTraits<Char>::CharPtr fmt::BasicWriter< Char >::CharPtr
private

Definition at line 2314 of file format.h.

Constructor & Destructor Documentation

◆ BasicWriter()

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

Constructs a BasicWriter object.

Definition at line 2414 of file format.h.

◆ ~BasicWriter()

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

\rst Destroys a BasicWriter object. \endrst

Definition at line 2422 of file format.h.

Member Function Documentation

◆ append_float_length() [1/2]

template<typename Char >
template<typename T >
void fmt::BasicWriter< Char >::append_float_length ( Char *&  ,
 
)
inlineprivate

Definition at line 2402 of file format.h.

◆ append_float_length() [2/2]

template<typename Char >
void fmt::BasicWriter< Char >::append_float_length ( Char *&  format_ptr,
long double   
)
inlineprivate

Definition at line 2397 of file format.h.

◆ buffer()

template<typename Char >
Buffer<Char>& fmt::BasicWriter< Char >::buffer ( )
inline

Definition at line 2577 of file format.h.

◆ 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.

Definition at line 2439 of file format.h.

◆ clear()

template<typename Char >
void fmt::BasicWriter< Char >::clear ( )
inline

Definition at line 2575 of file format.h.

◆ 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.

Definition at line 2433 of file format.h.

Here is the caller graph for this function:

◆ fill_padding()

template<typename Char >
BasicWriter< Char >::CharPtr fmt::BasicWriter< Char >::fill_padding ( CharPtr  buffer,
unsigned  total_size,
std::size_t  content_size,
wchar_t  fill 
)
staticprivate

Definition at line 2627 of file format.h.

Here is the caller graph for this function:

◆ FMT_DISALLOW_COPY_AND_ASSIGN()

template<typename Char >
fmt::BasicWriter< Char >::FMT_DISALLOW_COPY_AND_ASSIGN ( BasicWriter< Char >  )
private

◆ get()

template<typename Char >
static Char* fmt::BasicWriter< Char >::get ( Char *  p)
inlinestaticprivate

Definition at line 2320 of file format.h.

◆ grow_buffer()

template<typename Char >
CharPtr fmt::BasicWriter< Char >::grow_buffer ( std::size_t  n)
inlineprivate

Definition at line 2330 of file format.h.

Here is the caller graph for this function:

◆ operator<<() [1/16]

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

Writes a character to the stream.

Definition at line 2532 of file format.h.

◆ operator<<() [2/16]

template<typename Char >
template<typename StrChar >
BasicWriter& fmt::BasicWriter< Char >::operator<< ( const StrFormatSpec< StrChar > &  spec)
inline

Definition at line 2569 of file format.h.

◆ operator<<() [3/16]

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

Definition at line 2513 of file format.h.

◆ operator<<() [4/16]

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

\rst Writes value to the stream. \endrst

Definition at line 2548 of file format.h.

◆ operator<<() [5/16]

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

Definition at line 2485 of file format.h.

◆ operator<<() [6/16]

template<typename Char >
template<typename T , typename Spec , typename FillChar >
BasicWriter& fmt::BasicWriter< Char >::operator<< ( IntFormatSpec< T, Spec, FillChar >  spec)
inline

Definition at line 2562 of file format.h.

◆ operator<<() [7/16]

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

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

Definition at line 2524 of file format.h.

◆ operator<<() [8/16]

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

Definition at line 2492 of file format.h.

◆ operator<<() [9/16]

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

Definition at line 2499 of file format.h.

◆ operator<<() [10/16]

template<typename Char >
void fmt::BasicWriter< Char >::operator<< ( typename internal::WCharHelper< const wchar_t *, Char >::Unsupported  )
private

◆ operator<<() [11/16]

template<typename Char >
BasicWriter& fmt::BasicWriter< Char >::operator<< ( typename internal::WCharHelper< StringRef, Char >::Supported  value)
inline

Definition at line 2554 of file format.h.

◆ operator<<() [12/16]

template<typename Char >
BasicWriter& fmt::BasicWriter< Char >::operator<< ( typename internal::WCharHelper< wchar_t, Char >::Supported  value)
inline

Definition at line 2537 of file format.h.

◆ operator<<() [13/16]

template<typename Char >
void fmt::BasicWriter< Char >::operator<< ( typename internal::WCharHelper< wchar_t, Char >::Unsupported  )
private

◆ operator<<() [14/16]

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

\rst Formats value and writes it to the stream. \endrst

Definition at line 2509 of file format.h.

◆ operator<<() [15/16]

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

Definition at line 2496 of file format.h.

◆ operator<<() [16/16]

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

Definition at line 2489 of file format.h.

◆ prepare_int_buffer() [1/2]

template<typename Char >
CharPtr fmt::BasicWriter< Char >::prepare_int_buffer ( unsigned  num_digits,
const EmptySpec ,
const char *  prefix,
unsigned  prefix_size 
)
inlineprivate

Definition at line 2359 of file format.h.

◆ prepare_int_buffer() [2/2]

template<typename Char >
template<typename Spec >
BasicWriter< Char >::CharPtr fmt::BasicWriter< Char >::prepare_int_buffer ( unsigned  num_digits,
const Spec &  spec,
const char *  prefix,
unsigned  prefix_size 
)
private

Definition at line 2644 of file format.h.

◆ size()

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

Returns the total number of characters written.

Definition at line 2427 of file format.h.

Here is the caller graph for this function:

◆ str()

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

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

Definition at line 2451 of file format.h.

Here is the caller graph for this function:

◆ write()

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

\rst 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. \endrst

Definition at line 2480 of file format.h.

Here is the caller graph for this function:

◆ write_decimal()

template<typename Char >
template<typename Int >
void fmt::BasicWriter< Char >::write_decimal ( Int  value)
inlineprivate

Definition at line 2347 of file format.h.

◆ write_double()

template<typename Char >
template<typename T >
void fmt::BasicWriter< Char >::write_double ( value,
const FormatSpec spec 
)
private

Definition at line 2797 of file format.h.

Here is the caller graph for this function:

◆ write_int()

template<typename Char >
template<typename T , typename Spec >
void fmt::BasicWriter< Char >::write_int ( value,
Spec  spec 
)
private

Definition at line 2707 of file format.h.

Here is the caller graph for this function:

◆ write_str() [1/2]

template<typename Char >
template<typename StrChar >
void fmt::BasicWriter< Char >::write_str ( const internal::Arg::StringValue< StrChar > &  str,
const FormatSpec spec 
)
private

Definition at line 2605 of file format.h.

◆ write_str() [2/2]

template<typename Char >
template<typename StrChar >
BasicWriter< Char >::CharPtr fmt::BasicWriter< Char >::write_str ( const StrChar *  s,
std::size_t  size,
const AlignSpec spec 
)
private

Definition at line 2582 of file format.h.

Here is the caller graph for this function:

◆ write_unsigned_decimal()

template<typename Char >
template<typename UInt >
Char* fmt::BasicWriter< Char >::write_unsigned_decimal ( UInt  value,
unsigned  prefix_size = 0 
)
inlineprivate

Definition at line 2338 of file format.h.

Friends And Related Function Documentation

◆ internal::ArgFormatterBase

template<typename Char >
template<typename Impl , typename Char_ >
friend class internal::ArgFormatterBase
friend

Definition at line 2405 of file format.h.

◆ internal::BasicPrintfArgFormatter

template<typename Char >
template<typename Impl , typename Char_ >
friend class internal::BasicPrintfArgFormatter
friend

Definition at line 2408 of file format.h.

Member Data Documentation

◆ buffer_

template<typename Char >
Buffer<Char>& fmt::BasicWriter< Char >::buffer_
private

Definition at line 2310 of file format.h.


The documentation for this class was generated from the following file: