do_vformat_to -> vformat_to and update docs
This commit is contained in:
parent
d07ba49821
commit
5281ea6ad2
@ -22,7 +22,7 @@ arguments in the resulting string.
|
||||
|
||||
*args* is an argument list representing objects to be formatted.
|
||||
|
||||
The `performance of the format API
|
||||
The `performance of the formating functions
|
||||
<https://github.com/fmtlib/fmt/blob/master/README.rst#speed-tests>`_ is close
|
||||
to that of glibc's ``printf`` and better than the performance of IOStreams.
|
||||
|
||||
@ -127,7 +127,7 @@ custom argument formatter class::
|
||||
// with the ``x`` format specifier.
|
||||
class custom_arg_formatter : public arg_formatter {
|
||||
public:
|
||||
custom_arg_formatter(context_type &ctx, fmt::format_specs &spec)
|
||||
custom_arg_formatter(fmt::context &ctx, fmt::format_specs &spec)
|
||||
: arg_formatter(ctx, spec) {}
|
||||
|
||||
using arg_formatter::operator();
|
||||
@ -142,8 +142,8 @@ custom argument formatter class::
|
||||
|
||||
std::string custom_vformat(fmt::string_view format_str, fmt::format_args args) {
|
||||
fmt::memory_buffer buffer;
|
||||
// Pass custom argument formatter as a template arg to do_vformat.
|
||||
fmt::do_vformat_to<custom_arg_formatter>(buffer, format_str, args);
|
||||
// Pass custom argument formatter as a template arg to vformat_to.
|
||||
fmt::vformat_to<custom_arg_formatter>(buffer, format_str, args);
|
||||
return fmt::to_string(buffer);
|
||||
}
|
||||
|
||||
|
@ -183,9 +183,10 @@ typename std::add_rvalue_reference<T>::type declval() FMT_NOEXCEPT;
|
||||
/**
|
||||
\rst
|
||||
An implementation of ``std::basic_string_view`` for pre-C++17. It provides a
|
||||
subset of the API. fmt::basic_string_view is used for format strings even if
|
||||
std::string_view is available to prevent issues when a library is compiled
|
||||
with different -std option than the client code (which is not recommended).
|
||||
subset of the API. ``fmt::basic_string_view`` is used for format strings even
|
||||
if ``std::string_view`` is available to prevent issues when a library is
|
||||
compiled with a different ``-std`` option than the client code (which is not
|
||||
recommended).
|
||||
\endrst
|
||||
*/
|
||||
template <typename Char>
|
||||
|
@ -3197,7 +3197,7 @@ struct format_handler : internal::error_handler {
|
||||
|
||||
/** Formats arguments and writes the output to the buffer. */
|
||||
template <typename ArgFormatter, typename Char, typename Context>
|
||||
typename Context::iterator do_vformat_to(typename ArgFormatter::range out,
|
||||
typename Context::iterator vformat_to(typename ArgFormatter::range out,
|
||||
basic_string_view<Char> format_str,
|
||||
basic_format_args<Context> args) {
|
||||
typedef internal::null_terminating_iterator<Char> iterator;
|
||||
@ -3327,13 +3327,13 @@ std::basic_string<Char> to_string(const basic_memory_buffer<Char> &buffer) {
|
||||
inline void vformat_to(internal::buffer &buf, string_view format_str,
|
||||
format_args args) {
|
||||
typedef back_insert_range<internal::buffer> range;
|
||||
do_vformat_to<arg_formatter<range>>(buf, format_str, args);
|
||||
vformat_to<arg_formatter<range>>(buf, format_str, args);
|
||||
}
|
||||
|
||||
inline void vformat_to(internal::wbuffer &buf, wstring_view format_str,
|
||||
wformat_args args) {
|
||||
typedef back_insert_range<internal::wbuffer> range;
|
||||
do_vformat_to<arg_formatter<range>>(buf, format_str, args);
|
||||
vformat_to<arg_formatter<range>>(buf, format_str, args);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
@ -3362,7 +3362,7 @@ template <typename OutputIt, typename... Args>
|
||||
inline OutputIt vformat_to(OutputIt out, string_view format_str,
|
||||
typename format_args_t<OutputIt>::type args) {
|
||||
typedef output_range<OutputIt, char> range;
|
||||
return do_vformat_to<arg_formatter<range>>(range(out), format_str, args);
|
||||
return vformat_to<arg_formatter<range>>(range(out), format_str, args);
|
||||
}
|
||||
|
||||
template <typename OutputIt, typename... Args>
|
||||
@ -3465,7 +3465,7 @@ FMT_CONSTEXPR internal::udl_formatter<Char, CHARS...> operator""_format() {
|
||||
# else
|
||||
/**
|
||||
\rst
|
||||
C++11 literal equivalent of :func:`fmt::format`.
|
||||
User-defined literal equivalent of :func:`fmt::format`.
|
||||
|
||||
**Example**::
|
||||
|
||||
@ -3481,7 +3481,7 @@ operator"" _format(const wchar_t *s, std::size_t) { return {s}; }
|
||||
|
||||
/**
|
||||
\rst
|
||||
C++11 literal equivalent of :func:`fmt::arg`.
|
||||
User-defined literal equivalent of :func:`fmt::arg`.
|
||||
|
||||
**Example**::
|
||||
|
||||
|
@ -37,7 +37,7 @@ class CustomArgFormatter :
|
||||
std::string custom_vformat(fmt::string_view format_str, fmt::format_args args) {
|
||||
fmt::memory_buffer buffer;
|
||||
// Pass custom argument formatter as a template arg to vwrite.
|
||||
fmt::do_vformat_to<CustomArgFormatter>(buffer, format_str, args);
|
||||
fmt::vformat_to<CustomArgFormatter>(buffer, format_str, args);
|
||||
return std::string(buffer.data(), buffer.size());
|
||||
}
|
||||
|
||||
|
@ -1577,7 +1577,7 @@ class mock_arg_formatter:
|
||||
|
||||
void custom_vformat(fmt::string_view format_str, fmt::format_args args) {
|
||||
fmt::memory_buffer buffer;
|
||||
fmt::do_vformat_to<mock_arg_formatter>(buffer, format_str, args);
|
||||
fmt::vformat_to<mock_arg_formatter>(buffer, format_str, args);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
|
Loading…
Reference in New Issue
Block a user