Document Print.

This commit is contained in:
Victor Zverovich 2014-05-18 10:04:36 -07:00
parent e79bcfe5ab
commit 13a5b2511b
2 changed files with 22 additions and 6 deletions

View File

@ -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:

View File

@ -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<FileSink> Print(StringRef format) {
Formatter<FileSink> 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<FileSink> Print(std::FILE *file, StringRef format) {
Formatter<FileSink> f(format, FileSink(file));
return f;