DIY 3.0 data-parallel out-of-core C++ library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Typedefs Groups Pages
Public Member Functions | Protected Member Functions | Friends | List of all members
fmt::BasicWriter< Char > Class Template Reference

`#include <diy/fmt/format.h>`

Inheritance 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)
BasicWriter & | operator<< (int value)
BasicWriter & | operator<< (unsigned value)
BasicWriter & | operator<< (long value)
BasicWriter & | operator<< (unsigned long value)
BasicWriter & | operator<< (LongLong value)
BasicWriter & | operator<< (ULongLong value)
BasicWriter & | operator<< (double value)
BasicWriter & | operator<< (long double value)
BasicWriter & | operator<< (char value)
BasicWriter & | operator<< (typename internal::WCharHelper< wchar_t, Char >::Supported value)
BasicWriter & | operator<< (fmt::BasicStringRef< Char > value)
BasicWriter & | operator<< (typename internal::WCharHelper< StringRef, Char >::Supported value)
template<typename T , typename Spec , typename FillChar >
BasicWriter & | operator<< (IntFormatSpec< T, Spec, FillChar > spec)
template<typename StrChar >
BasicWriter & | operator<< (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)

## Friends
template<typename Impl , typename Char_ >
class | internal::ArgFormatterBase
class | internal::PrintfArgFormatter< Char >

## 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

template<typename Char>

fmt::BasicWriter< Char >::BasicWriter | ( | Buffer< Char > & | b | ) |
| inline explicit protected

Constructs a `BasicWriter` object.

template<typename Char>

virtual fmt::BasicWriter< Char >::~BasicWriter | ( |  | ) |
| inline virtual

Destroys a `BasicWriter` object.

## Member Function Documentation

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.

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.

template<typename Char>

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

Formats value and writes it to the stream.

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.

template<typename Char>

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

Writes value to the stream.

template<typename Char>

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

Returns the total number of characters written.

template<typename Char>

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

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

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

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

- include/diy/fmt/format.h