mirror of
https://github.com/fmtlib/fmt.git
synced 2025-04-10 12:44:48 +00:00
Merge locale.h into format-inl.h
This commit is contained in:
parent
6966db1dab
commit
6ebc1a967d
@ -95,8 +95,8 @@ function(add_headers VAR)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Define the fmt library, its includes and the needed defines.
|
# 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
|
add_headers(FMT_HEADERS core.h format.h format-inl.h ostream.h printf.h time.h
|
||||||
time.h ranges.h)
|
ranges.h)
|
||||||
set(FMT_SOURCES src/format.cc)
|
set(FMT_SOURCES src/format.cc)
|
||||||
if (HAVE_OPEN)
|
if (HAVE_OPEN)
|
||||||
add_headers(FMT_HEADERS posix.h)
|
add_headers(FMT_HEADERS posix.h)
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#define FMT_FORMAT_INL_H_
|
#define FMT_FORMAT_INL_H_
|
||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "locale.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -19,6 +18,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstddef> // for std::ptrdiff_t
|
#include <cstddef> // for std::ptrdiff_t
|
||||||
|
#include <locale>
|
||||||
|
|
||||||
#if defined(_WIN32) && defined(__MINGW32__)
|
#if defined(_WIN32) && defined(__MINGW32__)
|
||||||
# include <cstring>
|
# include <cstring>
|
||||||
@ -205,6 +205,15 @@ void report_error(FormatFunc func, int error_code,
|
|||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
class locale {
|
||||||
|
private:
|
||||||
|
std::locale locale_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit locale(std::locale loc = std::locale()) : locale_(loc) {}
|
||||||
|
std::locale get() { return locale_; }
|
||||||
|
};
|
||||||
|
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
FMT_FUNC Char internal::thousands_sep(locale_provider *lp) {
|
FMT_FUNC Char internal::thousands_sep(locale_provider *lp) {
|
||||||
std::locale loc = lp ? lp->locale().get() : std::locale();
|
std::locale loc = lp ? lp->locale().get() : std::locale();
|
||||||
|
@ -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 <locale>
|
|
||||||
|
|
||||||
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_
|
|
@ -17,7 +17,6 @@
|
|||||||
# include <type_traits>
|
# include <type_traits>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fmt/locale.h"
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest-extra.h"
|
#include "gtest-extra.h"
|
||||||
#include "mock-allocator.h"
|
#include "mock-allocator.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user