40 using type =
typename S::char_type;
50 std::use_facet<std::numpunct<wchar_t>>(loc.get<std::locale>());
51 auto separator = std::wstring();
72 static constexpr int num_static_named_args =
76 Char,
static_cast<int>(
sizeof...(T)), num_static_named_args,
92 FMT_ENABLE_IF(std::is_base_of<detail::compile_string, S>::value&&
93 std::is_same<typename S::char_type, Char>::value)>
106template <
typename Char,
typename... T>
109template <
typename... T>
115template <>
struct is_char<wchar_t> : std::true_type {};
116template <>
struct is_char<char16_t> : std::true_type {};
117template <>
struct is_char<char32_t> : std::true_type {};
123template <
typename... T>
125 ->
decltype(fmt::make_format_args<wformat_context>(args...)) {
126 return fmt::make_format_args<wformat_context>(args...);
129#if !FMT_USE_NONTYPE_TEMPLATE_ARGS
137template <
typename It,
typename Sentinel>
140 return {begin, end, sep};
143template <
typename Range, FMT_ENABLE_IF(!is_tuple_like<Range>::value)>
145 ->
join_view<
decltype(std::begin(range)),
decltype(std::end(range)),
147 return join(std::begin(range), std::end(range), sep);
153 return join(std::begin(list), std::end(list), sep);
156template <
typename Tuple, FMT_ENABLE_IF(is_tuple_like<Tuple>::value)>
162template <
typename Char, FMT_ENABLE_IF(!std::is_same<Char,
char>::value)>
165 -> std::basic_string<Char> {
168 return {buf.data(), buf.size()};
171template <
typename... T>
173 return vformat(fmt::wstring_view(fmt), fmt::make_wformat_args(args...));
176template <
typename OutputIt,
typename... T>
179 return vformat_to(out, fmt::wstring_view(fmt),
180 fmt::make_wformat_args(args...));
185template <
typename S,
typename... T,
188 !std::is_same<Char, wchar_t>::value)>
189auto format(
const S& fmt, T&&... args) -> std::basic_string<Char> {
194template <
typename S,
typename Char = detail::format_
string_
char_t<S>,
195 FMT_ENABLE_IF(detail::is_exotic_
char<Char>::value)>
198 -> std::basic_string<Char> {
202 return {buf.data(), buf.size()};
205template <
typename S,
typename... T,
209 -> std::basic_string<Char> {
214template <
typename OutputIt,
typename S,
225template <
typename OutputIt,
typename S,
typename... T,
228 !std::is_same<Char, char>::value &&
229 !std::is_same<Char, wchar_t>::value)>
230inline auto format_to(OutputIt out,
const S& fmt, T&&... args) -> OutputIt {
235template <
typename S,
typename OutputIt,
typename... Args,
247template <
typename OutputIt,
typename S,
typename... T,
253 typename std::enable_if<enable, OutputIt>::type {
258template <
typename OutputIt,
typename Char,
typename... Args,
267 return {buf.out(), buf.count()};
270template <
typename OutputIt,
typename S,
typename... T,
274inline auto format_to_n(OutputIt out,
size_t n,
const S& fmt, T&&... args)
276 return vformat_to_n(out, n, fmt::basic_string_view<Char>(fmt),
280template <
typename S,
typename... T,
293 buf.push_back(L
'\0');
294 if (std::fputws(buf.data(), f) == -1)
299 vprint(stdout, fmt, args);
302template <
typename... T>
311template <
typename... T>
313 return print(f, L
"{}\n", fmt::format(fmt, std::forward<T>(args)...));
317 return print(L
"{}\n", fmt::format(fmt, std::forward<T>(args)...));
324 return {buf.data(), buf.size()};
327template <
typename... T>
330 return fmt::vformat(ts, fmt, fmt::make_wformat_args(args...));
333template <
typename... T>
336 vprint(f, ts, fmt, fmt::make_wformat_args(args...));
339template <
typename... T>
342 return print(stdout, ts, fmt, args...);
351template <
typename... T>
356template <
typename... T>
358 print(os, L
"{}\n", fmt::format(fmt, std::forward<T>(args)...));
362template <
typename T>
inline auto to_wstring(
const T& value) -> std::wstring {
An implementation of std::basic_string_view for pre-C++17.
Definition base.h:504
Parsing context consisting of a format string range being parsed and an argument counter for automati...
Definition base.h:845
A text style consisting of foreground and background colors and emphasis.
Definition color.h:231
detail namespace with internal helper functions
Definition input_adapters.h:32
auto get_iterator(Buf &buf, OutputIt) -> decltype(buf.out())
Definition base.h:2044
FMT_CONSTEXPR void ignore_unused(const T &...)
Definition base.h:348
constexpr auto count_static_named_args() -> int
Definition base.h:1036
constexpr auto count_named_args() -> int
Definition base.h:1033
typename std::enable_if< B, T >::type enable_if_t
Definition cpp_future.h:38
@ value
the parser finished reading a JSON value
typename format_string_char< S >::type format_string_char_t
Definition xchar.h:44
auto write_loc(OutputIt, const loc_value &, const format_specs &, locale_ref) -> bool
Definition format.h:1958
bool_constant<!std::is_same< T, char >::value > is_exotic_char
Definition xchar.h:27
FMT_CONSTEXPR void parse_format_string(basic_string_view< Char > fmt, Handler &&handler)
Definition base.h:1591
typename make_void< Ts... >::type void_t
Definition void_t.h:21
void write_buffer(std::basic_ostream< Char > &os, buffer< Char > &buf)
Definition ostream.h:55
typename V::value_type char_t
String's character (code unit) type. detail:: is intentional to prevent ADL.
Definition base.h:935
constexpr auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition base.h:910
std::integral_constant< bool, Value > bool_constant
Definition type_traits.h:743
auto get_buffer(OutputIt out) -> iterator_buffer< OutputIt, T >
Definition base.h:2034
void vformat_to(buffer< Char > &buf, basic_string_view< Char > fmt, typename vformat_args< Char >::type args, locale_ref loc={})
Definition format.h:3665
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280
FMT_CONSTEVAL FMT_ALWAYS_INLINE basic_fstring(const S &s)
Definition xchar.h:87
basic_fstring(runtime_format_string< Char > fmt)
Definition xchar.h:100
FMT_ALWAYS_INLINE basic_fstring(const S &)
Definition xchar.h:94
auto get() const -> basic_string_view< Char >
Definition xchar.h:103
Definition format-inl.h:93
auto grouping() const -> std::string
Definition format-inl.h:94
auto thousands_sep() const -> Char
Definition format-inl.h:95
#define S(label, offset, message)
Definition Errors.h:113
#define FMT_END_EXPORT
Definition base.h:250
std::integral_constant< bool, B > bool_constant
Definition base.h:300
#define FMT_CONSTEVAL
Definition base.h:140
#define FMT_CONSTEXPR
Definition base.h:113
#define FMT_ALWAYS_INLINE
Definition base.h:203
#define FMT_BEGIN_NAMESPACE
Definition base.h:239
#define FMT_USE_CONSTEVAL
Definition base.h:118
#define FMT_ENABLE_IF(...)
Definition base.h:334
#define FMT_BEGIN_EXPORT
Definition base.h:249
std::is_constructible< formatter< T, Char > > FMT_DEPRECATED
Definition base.h:2732
#define FMT_END_NAMESPACE
Definition base.h:242
conditional_t< std::is_same< Char, char >::value, context, generic_context< basic_appender< Char >, Char > > buffered_context
Definition base.h:638
auto format(wformat_string< T... > fmt, T &&... args) -> std::wstring
Definition xchar.h:172
auto vformat_to_n(OutputIt out, size_t n, basic_string_view< Char > fmt, typename detail::vformat_args< Char >::type args) -> format_to_n_result< OutputIt >
Definition xchar.h:261
buffered_context< wchar_t > wformat_context
Definition xchar.h:64
auto formatted_size(const S &fmt, T &&... args) -> size_t
Definition xchar.h:283
auto vformat_to(OutputIt out, const S &fmt, typename detail::vformat_args< Char >::type args) -> OutputIt
Definition xchar.h:218
constexpr auto make_wformat_args(T &... args) -> decltype(fmt::make_format_args< wformat_context >(args...))
Definition xchar.h:124
basic_string_view< wchar_t > wstring_view
Definition xchar.h:62
auto format_to_n(OutputIt out, size_t n, const S &fmt, T &&... args) -> format_to_n_result< OutputIt >
Definition xchar.h:274
basic_memory_buffer< wchar_t > wmemory_buffer
Definition xchar.h:66
typename basic_format_string< wchar_t, T... >::t wformat_string
Definition xchar.h:110
auto format_to(OutputIt out, wformat_string< T... > fmt, T &&... args) -> OutputIt
Definition xchar.h:177
auto to_wstring(const T &value) -> std::wstring
Converts value to std::wstring using the default format for type T.
Definition xchar.h:362
auto join(It begin, Sentinel end, wstring_view sep) -> join_view< It, Sentinel, wchar_t >
Definition xchar.h:138
void print(std::FILE *f, wformat_string< T... > fmt, T &&... args)
Definition xchar.h:303
auto runtime(wstring_view s) -> runtime_format_string< wchar_t >
Definition xchar.h:111
void vprint(std::FILE *f, wstring_view fmt, wformat_args args)
Definition xchar.h:290
auto vformat(basic_string_view< Char > fmt, typename detail::vformat_args< Char >::type args) -> std::basic_string< Char >
Definition xchar.h:163
void println(std::FILE *f, wformat_string< T... > fmt, T &&... args)
Definition xchar.h:312