From 1042ddda0f728d85bb996c29f630890b52ef21bb Mon Sep 17 00:00:00 2001 From: vitaut Date: Fri, 18 Dec 2015 07:07:41 -0800 Subject: [PATCH] Document BasicFormatter --- format.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/format.h b/format.h index 827592f3..109bcec3 100644 --- a/format.h +++ b/format.h @@ -1840,10 +1840,11 @@ class PrintfFormatter : private FormatterBase { }; } // namespace internal -// A formatter. +/** This template formats data and writes the output to a writer. */ template class BasicFormatter : private internal::FormatterBase { public: + /** The character type for the output. */ typedef CharType Char; private: @@ -1865,13 +1866,23 @@ class BasicFormatter : private internal::FormatterBase { internal::Arg parse_arg_name(const Char *&s); public: + /** + * \rst + * Constructs a ``BasicFormatter`` object. References to the arguments and + * the writer are stored in the formatter object so make sure they have + * appropriate lifetimes. + * \endrst + */ BasicFormatter(const ArgList &args, BasicWriter &w) : internal::FormatterBase(args), writer_(w) {} + /** Returns a reference to the writer associated with this formatter. */ BasicWriter &writer() { return writer_; } + /** Formats stored arguments and writes the output to the writer. */ void format(BasicCStringRef format_str); + // Formats a single argument and advances format_str, a format string pointer. const Char *format(const Char *&format_str, const internal::Arg &arg); }; @@ -3468,7 +3479,6 @@ inline internal::Arg BasicFormatter::parse_arg_name(const Char *&s) { return arg; } -// Should be after FormatSpec template const Char *BasicFormatter::format( const Char *&format_str, const internal::Arg &arg) {