// Formatting library for C++ - std::locale support // // Copyright (c) 2012 - present, Victor Zverovich // All rights reserved. // // For the license information refer to format.h. #ifndef FMT_LOCALE_H_ #define FMT_LOCALE_H_ #include #include "format.h" FMT_BEGIN_NAMESPACE namespace internal { template typename buffer_context::type::iterator vformat_to( const std::locale& loc, basic_buffer& buf, basic_string_view format_str, basic_format_args::type> args) { typedef back_insert_range> range; return vformat_to>(buf, to_string_view(format_str), args, internal::locale_ref(loc)); } template std::basic_string vformat( const std::locale& loc, basic_string_view format_str, basic_format_args::type> args) { basic_memory_buffer buffer; internal::vformat_to(loc, buffer, format_str, args); return fmt::to_string(buffer); } } // namespace internal template inline std::basic_string vformat( const std::locale& loc, const S& format_str, basic_format_args::type> args) { return internal::vformat(loc, to_string_view(format_str), args); } template inline std::basic_string format(const std::locale& loc, const S& format_str, const Args&... args) { return internal::vformat( loc, to_string_view(format_str), *internal::checked_args(format_str, args...)); } template inline typename std::enable_if::value, OutputIt>::type vformat_to(OutputIt out, const std::locale& loc, const String& format_str, typename format_args_t::type args) { typedef output_range range; return vformat_to>( range(out), to_string_view(format_str), args, internal::locale_ref(loc)); } template inline typename std::enable_if::value && internal::is_output_iterator::value, OutputIt>::type format_to(OutputIt out, const std::locale& loc, const S& format_str, const Args&... args) { internal::check_format_string(format_str); typedef typename format_context_t::type context; format_arg_store as{args...}; return vformat_to(out, loc, to_string_view(format_str), basic_format_args(as)); } FMT_END_NAMESPACE #endif // FMT_LOCALE_H_