NGL  6.5
The NCCA Graphics Library
fmt::BasicWriter< Char > Class Template Reference

#include <format.h>

+ Inheritance diagram for fmt::BasicWriter< Char >:
+ Collaboration diagram for fmt::BasicWriter< Char >:

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

Definition at line 376 of file format.h.

Member Typedef Documentation

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

Definition at line 2349 of file format.h.

Constructor & Destructor Documentation

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

Constructs a BasicWriter object.

Definition at line 2449 of file format.h.

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

Destroys a BasicWriter object.

Definition at line 2457 of file format.h.

Member Function Documentation

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

Definition at line 2432 of file format.h.

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

Definition at line 2437 of file format.h.

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

Definition at line 2612 of file format.h.

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 2474 of file format.h.

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

+ Here is the call graph for this function:

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

Definition at line 2610 of file format.h.

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 2468 of file format.h.

+ Here is the caller graph for this function:

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 2661 of file format.h.

+ Here is the caller graph for this function:

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

Definition at line 2355 of file format.h.

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

Definition at line 2365 of file format.h.

References fmt::internal::make_ptr(), fmt::Buffer< T >::resize(), and fmt::Buffer< T >::size().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 2520 of file format.h.

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

Definition at line 2524 of file format.h.

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

Definition at line 2527 of file format.h.

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

Definition at line 2531 of file format.h.

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

Definition at line 2534 of file format.h.

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

Formats value and writes it to the stream.

Definition at line 2544 of file format.h.

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

Definition at line 2548 of file format.h.

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.

Definition at line 2559 of file format.h.

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

Writes a character to the stream.

Definition at line 2567 of file format.h.

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

Definition at line 2572 of file format.h.

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

Writes value to the stream.

Definition at line 2583 of file format.h.

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

Definition at line 2589 of file format.h.

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

Definition at line 2597 of file format.h.

References fmt::internal::convert().

+ Here is the call graph for this function:

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

Definition at line 2604 of file format.h.

References fmt::BasicWriter< Char >::str().

+ Here is the call graph for this function:

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 2394 of file format.h.

References fmt::internal::operator<<().

+ Here is the call graph for this function:

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 2678 of file format.h.

References fmt::ALIGN_CENTER, fmt::ALIGN_LEFT, and fmt::internal::to_unsigned().

+ Here is the call graph for this function:

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

Returns the total number of characters written.

Definition at line 2462 of file format.h.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Definition at line 2486 of file format.h.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Definition at line 2515 of file format.h.

References FMT_VARIADIC_VOID, fmt::format(), and fmt::internal::write().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 2382 of file format.h.

References fmt::internal::is_negative().

+ Here is the call graph for this function:

template<typename Char >
template<typename T , typename Spec >
void fmt::BasicWriter< Char >::write_int ( value,
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 
)
private

Definition at line 2617 of file format.h.

References fmt::AlignSpec::align(), fmt::ALIGN_CENTER, fmt::ALIGN_RIGHT, fmt::WidthSpec::fill(), and fmt::WidthSpec::width().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename Char >
template<typename StrChar >
void fmt::BasicWriter< Char >::write_str ( const internal::Arg::StringValue< StrChar > &  str,
const FormatSpec spec 
)
private
template<typename Char>
template<typename UInt >
Char* fmt::BasicWriter< Char >::write_unsigned_decimal ( UInt  value,
unsigned  prefix_size = 0 
)
inlineprivate

Definition at line 2373 of file format.h.

References fmt::internal::count_digits(), and fmt::internal::format_decimal().

+ Here is the call graph for this function:

Friends And Related Function Documentation

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

Definition at line 2443 of file format.h.

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

Definition at line 2440 of file format.h.

Member Data Documentation

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

Definition at line 2345 of file format.h.


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