diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2023-12-27 00:32:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 01:32:01 +0100 |
commit | f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287 (patch) | |
tree | 90f2c6a4885dbd181799e2325cf33588697674e1 /primedev/thirdparty/spdlog/fmt/bundled/locale.h | |
parent | bb8ed59f6891b1196c5f5bbe7346cd171c8215fa (diff) | |
download | NorthstarLauncher-f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287.tar.gz NorthstarLauncher-f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287.zip |
Folder restructuring from primedev (#624)v1.21.2-rc3v1.21.2
Copies of over the primedev folder structure for easier cherry-picking of further changes
Co-authored-by: F1F7Y <filip.bartos07@proton.me>
Diffstat (limited to 'primedev/thirdparty/spdlog/fmt/bundled/locale.h')
-rw-r--r-- | primedev/thirdparty/spdlog/fmt/bundled/locale.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/primedev/thirdparty/spdlog/fmt/bundled/locale.h b/primedev/thirdparty/spdlog/fmt/bundled/locale.h new file mode 100644 index 00000000..7301bf92 --- /dev/null +++ b/primedev/thirdparty/spdlog/fmt/bundled/locale.h @@ -0,0 +1,64 @@ +// 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 <locale> + +#include "format.h" + +FMT_BEGIN_NAMESPACE + +namespace detail { +template <typename Char> +std::basic_string<Char> vformat( + const std::locale& loc, basic_string_view<Char> format_str, + basic_format_args<buffer_context<type_identity_t<Char>>> args) { + basic_memory_buffer<Char> buffer; + detail::vformat_to(buffer, format_str, args, detail::locale_ref(loc)); + return fmt::to_string(buffer); +} +} // namespace detail + +template <typename S, typename Char = char_t<S>> +inline std::basic_string<Char> vformat( + const std::locale& loc, const S& format_str, + basic_format_args<buffer_context<type_identity_t<Char>>> args) { + return detail::vformat(loc, to_string_view(format_str), args); +} + +template <typename S, typename... Args, typename Char = char_t<S>> +inline std::basic_string<Char> format(const std::locale& loc, + const S& format_str, Args&&... args) { + return detail::vformat(loc, to_string_view(format_str), + fmt::make_args_checked<Args...>(format_str, args...)); +} + +template <typename S, typename OutputIt, typename... Args, + typename Char = char_t<S>, + FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, Char>::value)> +inline OutputIt vformat_to( + OutputIt out, const std::locale& loc, const S& format_str, + basic_format_args<buffer_context<type_identity_t<Char>>> args) { + decltype(detail::get_buffer<Char>(out)) buf(detail::get_buffer_init(out)); + vformat_to(buf, to_string_view(format_str), args, detail::locale_ref(loc)); + return detail::get_iterator(buf); +} + +template <typename OutputIt, typename S, typename... Args, + bool enable = detail::is_output_iterator<OutputIt, char_t<S>>::value> +inline auto format_to(OutputIt out, const std::locale& loc, + const S& format_str, Args&&... args) -> + typename std::enable_if<enable, OutputIt>::type { + const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...); + return vformat_to(out, loc, to_string_view(format_str), vargs); +} + +FMT_END_NAMESPACE + +#endif // FMT_LOCALE_H_ |