mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-02 23:21:45 +01:00
Add an overload of print that accepts std::ostream.
This commit is contained in:
18
format.h
18
format.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Formatting library for C++
|
||||
|
||||
Copyright (c) 2012, Victor Zverovich
|
||||
Copyright (c) 2012 - 2014, Victor Zverovich
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -128,8 +128,6 @@ class BasicWriter;
|
||||
typedef BasicWriter<char> Writer;
|
||||
typedef BasicWriter<wchar_t> WWriter;
|
||||
|
||||
struct FormatSpec;
|
||||
|
||||
template <typename Char>
|
||||
class BasicFormatter;
|
||||
|
||||
@@ -751,6 +749,8 @@ class ArgList {
|
||||
}
|
||||
};
|
||||
|
||||
struct FormatSpec;
|
||||
|
||||
// A formatter.
|
||||
template <typename Char>
|
||||
class BasicFormatter {
|
||||
@@ -1691,6 +1691,17 @@ void print(StringRef format, const ArgList &args);
|
||||
*/
|
||||
void print(std::FILE *f, StringRef format, const ArgList &args);
|
||||
|
||||
/**
|
||||
\rst
|
||||
Prints formatted data to a stream.
|
||||
|
||||
**Example**::
|
||||
|
||||
print(cerr, "Don't {}!", "panic");
|
||||
\endrst
|
||||
*/
|
||||
void print(std::ostream &os, StringRef format, const ArgList &args);
|
||||
|
||||
template <typename Char>
|
||||
void printf(BasicWriter<Char> &w,
|
||||
BasicStringRef<Char> format, const ArgList &args) {
|
||||
@@ -1901,6 +1912,7 @@ FMT_VARIADIC(std::string, format, StringRef)
|
||||
FMT_VARIADIC_W(std::wstring, format, WStringRef)
|
||||
FMT_VARIADIC(void, print, StringRef)
|
||||
FMT_VARIADIC(void, print, std::FILE *, StringRef)
|
||||
FMT_VARIADIC(void, print, std::ostream &, StringRef)
|
||||
FMT_VARIADIC(void, print_colored, Color, StringRef)
|
||||
FMT_VARIADIC(std::string, sprintf, StringRef)
|
||||
FMT_VARIADIC(void, printf, StringRef)
|
||||
|
||||
Reference in New Issue
Block a user