From 13a5b2511ba7b60fd93f1ad04eaaa77781e14d79 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 18 May 2014 10:04:36 -0700 Subject: [PATCH] Document Print. --- doc/index.rst | 4 ++++ format.h | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/index.rst b/doc/index.rst index 5e53f4a7..2fd2ed76 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -13,6 +13,10 @@ namespace is usually omitted in examples. .. doxygenfunction:: fmt::Format(StringRef, const Args &...) +.. doxygenfunction:: fmt::Print(StringRef) + +.. doxygenfunction:: fmt::Print(std::FILE *, StringRef) + .. doxygenclass:: fmt::BasicWriter :members: diff --git a/format.h b/format.h index 856dbb6c..b1d8d609 100644 --- a/format.h +++ b/format.h @@ -1659,17 +1659,29 @@ class FileSink { } }; -// Formats a string and prints it to stdout. -// Example: -// Print("Elapsed time: {0:.2f} seconds") << 1.23; +/** + \rst + Formats a string and writes the result to ``stdout``. + + **Example**:: + + Print("Elapsed time: {0:.2f} seconds") << 1.23; + \endrst + */ inline Formatter Print(StringRef format) { Formatter f(format, FileSink(stdout)); return f; } -// Formats a string and prints it to a file. -// Example: -// Print(stderr, "Don't {}!") << "panic"; +/** + \rst + Formats a string and writes the result to a file. + + **Example**:: + + Print(stderr, "Don't {}!") << "panic"; + \endrst + */ inline Formatter Print(std::FILE *file, StringRef format) { Formatter f(format, FileSink(file)); return f;