diff options
author | Emma Miler <emma.pi@protonmail.com> | 2022-12-02 23:00:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-02 23:00:33 +0100 |
commit | 2d59006262d6e45f41ee325af78433475884dca4 (patch) | |
tree | 939c84779bf6a455102c74937f238a0ec05698eb /include/spdlog/fmt/bundled/locale.h | |
parent | be78dbacc5dcc95e7d9be503d61ceb5de640c661 (diff) | |
download | NorthstarLauncher-2d59006262d6e45f41ee325af78433475884dca4.tar.gz NorthstarLauncher-2d59006262d6e45f41ee325af78433475884dca4.zip |
Move include directory (#337)v1.11.0-rc1
* Move include directory to shared folder
This commit moves the `include` directory from the NorthstarDLL project folder to the solution folder. This allows both the DLL and Launcher project to target it properly.
* Fix filters
* Update memalloc.h
* Fix filters
* Update NorthstarLauncher.vcxproj
* Remove stuff from other PR
* Update NorthstarLauncher.vcxproj
* Update NorthstarLauncher.vcxproj
* Update NorthstarDLL.vcxproj
Diffstat (limited to 'include/spdlog/fmt/bundled/locale.h')
-rw-r--r-- | include/spdlog/fmt/bundled/locale.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/include/spdlog/fmt/bundled/locale.h b/include/spdlog/fmt/bundled/locale.h new file mode 100644 index 00000000..7301bf92 --- /dev/null +++ b/include/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_ |