Rosetta  2020.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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]

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
 
template<typename StrChar >
BasicWriter< Char >::CharPtr write_str (const StrChar *s, std::size_t size, const AlignSpec &spec)
 
template<typename Spec >
BasicWriter< Char >::CharPtr prepare_int_buffer (unsigned num_digits, const Spec &spec, const char *prefix, unsigned prefix_size)
 

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 , typename Spec >
void write_double (T value, const Spec &spec)
 
template<typename StrChar >
CharPtr write_str (const StrChar *s, std::size_t size, const AlignSpec &spec)
 
template<typename StrChar , typename Spec >
void write_str (const internal::Arg::StringValue< StrChar > &str, const Spec &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_ , 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> | +------—+-------------------—+

Member Typedef Documentation

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

Constructor & Destructor Documentation

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

Constructs a BasicWriter object.

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

Destroys a BasicWriter object.

Member Function Documentation

template<typename Char>
void fmt::BasicWriter< Char >::append_float_length ( Char *&  format_ptr,
long  double 
)
inlineprivate
template<typename Char>
template<typename T >
void fmt::BasicWriter< Char >::append_float_length ( Char *&  ,
T   
)
inlineprivate
template<typename Char>
Buffer<Char>& fmt::BasicWriter< Char >::buffer ( )
inline
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.

References fmt::Buffer< T >::reserve(), amino_acids::size, and fmt::Buffer< T >::size().

template<typename Char>
void fmt::BasicWriter< Char >::clear ( )
inline
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.

Referenced by fmt::print().

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
template<typename Char>
fmt::BasicWriter< Char >::FMT_DISALLOW_COPY_AND_ASSIGN ( BasicWriter< Char >  )
private
template<typename Char>
static Char* fmt::BasicWriter< Char >::get ( Char *  p)
inlinestaticprivate
template<typename Char>
CharPtr fmt::BasicWriter< Char >::grow_buffer ( std::size_t  n)
inlineprivate
template<typename Char>
void fmt::BasicWriter< Char >::operator<< ( typename internal::WCharHelper< wchar_t, Char >::Unsupported  )
private
template<typename Char>
void fmt::BasicWriter< Char >::operator<< ( typename internal::WCharHelper< const wchar_t *, Char >::Unsupported  )
private
template<typename Char>
BasicWriter& fmt::BasicWriter< Char >::operator<< ( int  value)
inline
template<typename Char>
BasicWriter& fmt::BasicWriter< Char >::operator<< ( unsigned  value)
inline

References value.

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

References value.

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

Formats value and writes it to the stream.

References value.

template<typename Char>
BasicWriter& fmt::BasicWriter< Char >::operator<< ( double  value)
inline
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.

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

Writes a character to the stream.

References fmt::Buffer< T >::push_back().

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

Writes value to the stream.

References fmt::Buffer< T >::append(), and value.

template<typename Char>
BasicWriter& fmt::BasicWriter< Char >::operator<< ( typename internal::WCharHelper< StringRef, Char >::Supported  value)
inline
template<typename Char>
template<typename T , typename Spec , typename FillChar >
BasicWriter& fmt::BasicWriter< Char >::operator<< ( IntFormatSpec< T, Spec, FillChar >  spec)
inline

References convert().

template<typename Char>
template<typename StrChar >
BasicWriter& fmt::BasicWriter< Char >::operator<< ( const StrFormatSpec< StrChar > &  spec)
inline
template<typename Char>
CharPtr fmt::BasicWriter< Char >::prepare_int_buffer ( unsigned  num_digits,
const EmptySpec ,
const char *  prefix,
unsigned  prefix_size 
)
inlineprivate
template<typename Char>
template<typename Spec >
CharPtr fmt::BasicWriter< Char >::prepare_int_buffer ( unsigned  num_digits,
const Spec &  spec,
const char *  prefix,
unsigned  prefix_size 
)
private
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 
)
template<typename Char>
std::size_t fmt::BasicWriter< Char >::size ( ) const
inline

Returns the total number of characters written.

References fmt::Buffer< T >::size().

Referenced by fmt::print().

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

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

Referenced by fmt::format(), and fmt::SystemError::init().

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.

References auto-DRRAFTER_setup::args, and fmt::format().

Referenced by fmt::format(), and fmt::print().

template<typename Char>
template<typename Int >
void fmt::BasicWriter< Char >::write_decimal ( Int  value)
inlineprivate
template<typename Char >
template<typename T , typename Spec >
void fmt::BasicWriter< Char >::write_double ( T  value,
const Spec &  spec 
)
private
template<typename Char >
template<typename T , typename Spec >
void fmt::BasicWriter< Char >::write_int ( T  value,
Spec  spec 
)
private
template<typename Char>
template<typename StrChar >
CharPtr fmt::BasicWriter< Char >::write_str ( const StrChar *  s,
std::size_t  size,
const AlignSpec spec 
)
private
template<typename Char >
template<typename StrChar , typename Spec >
void fmt::BasicWriter< Char >::write_str ( const internal::Arg::StringValue< StrChar > &  str,
const Spec &  spec 
)
private
template<typename Char>
template<typename StrChar >
BasicWriter<Char>::CharPtr fmt::BasicWriter< Char >::write_str ( const StrChar *  s,
std::size_t  size,
const AlignSpec spec 
)
template<typename Char>
template<typename UInt >
Char* fmt::BasicWriter< Char >::write_unsigned_decimal ( UInt  value,
unsigned  prefix_size = 0 
)
inlineprivate

Friends And Related Function Documentation

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

Member Data Documentation

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

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