From 6ebc1a967d9a54f8209b3c415039aff3979dd762 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 20 May 2018 17:16:34 -0700 Subject: [PATCH] Merge locale.h into format-inl.h --- CMakeLists.txt | 4 ++-- include/fmt/format-inl.h | 11 ++++++++++- include/fmt/locale.h | 25 ------------------------- test/util-test.cc | 1 - 4 files changed, 12 insertions(+), 29 deletions(-) delete mode 100644 include/fmt/locale.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 639dc7fc..e0626131 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,8 +95,8 @@ function(add_headers VAR) endfunction() # Define the fmt library, its includes and the needed defines. -add_headers(FMT_HEADERS core.h format.h format-inl.h locale.h ostream.h printf.h - time.h ranges.h) +add_headers(FMT_HEADERS core.h format.h format-inl.h ostream.h printf.h time.h + ranges.h) set(FMT_SOURCES src/format.cc) if (HAVE_OPEN) add_headers(FMT_HEADERS posix.h) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 19d5dd8b..223ed516 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -9,7 +9,6 @@ #define FMT_FORMAT_INL_H_ #include "format.h" -#include "locale.h" #include @@ -19,6 +18,7 @@ #include #include #include // for std::ptrdiff_t +#include #if defined(_WIN32) && defined(__MINGW32__) # include @@ -205,6 +205,15 @@ void report_error(FormatFunc func, int error_code, } } // namespace +class locale { + private: + std::locale locale_; + + public: + explicit locale(std::locale loc = std::locale()) : locale_(loc) {} + std::locale get() { return locale_; } +}; + template FMT_FUNC Char internal::thousands_sep(locale_provider *lp) { std::locale loc = lp ? lp->locale().get() : std::locale(); diff --git a/include/fmt/locale.h b/include/fmt/locale.h deleted file mode 100644 index a6a4b748..00000000 --- a/include/fmt/locale.h +++ /dev/null @@ -1,25 +0,0 @@ -// Formatting library for C++ - locale support -// -// Copyright (c) 2012 - 2016, Victor Zverovich -// All rights reserved. -// -// For the license information refer to format.h. - -#ifndef FMT_LOCALE_H_ -#define FMT_LOCALE_H_ - -#include "format.h" -#include - -FMT_BEGIN_NAMESPACE -class locale { - private: - std::locale locale_; - - public: - explicit locale(std::locale loc = std::locale()) : locale_(loc) {} - std::locale get() { return locale_; } -}; -FMT_END_NAMESPACE - -#endif // FMT_LOCALE_ diff --git a/test/util-test.cc b/test/util-test.cc index 07509118..7c7b6079 100644 --- a/test/util-test.cc +++ b/test/util-test.cc @@ -17,7 +17,6 @@ # include #endif -#include "fmt/locale.h" #include "gmock/gmock.h" #include "gtest-extra.h" #include "mock-allocator.h"