[libc++] Move numpunct into <__locale_dir/num.h> (#212465)
`numpunct` is part of the `num` family of facets, so it should live in `num.h`.
This commit is contained in:
parent
c27b35739d
commit
98cdcbae77
9 changed files with 117 additions and 98 deletions
|
|
@ -52,6 +52,7 @@
|
|||
# include <__format/write_escaped.h>
|
||||
# include <__iterator/istreambuf_iterator.h>
|
||||
# include <__iterator/ostreambuf_iterator.h>
|
||||
# include <__locale_dir/num.h>
|
||||
# include <__locale_dir/time.h>
|
||||
# include <__memory/addressof.h>
|
||||
# include <__type_traits/is_specialization.h>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include <__format/formatter_output.h>
|
||||
#include <__format/parser_std_format_spec.h>
|
||||
#include <__iterator/concepts.h>
|
||||
#include <__locale_dir/num.h>
|
||||
#include <__math/traits.h>
|
||||
#include <__memory/allocator.h>
|
||||
#include <__system_error/errc.h>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <__format/parser_std_format_spec.h>
|
||||
#include <__iterator/concepts.h>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__locale_dir/num.h>
|
||||
#include <__memory/pointer_traits.h>
|
||||
#include <__system_error/errc.h>
|
||||
#include <__type_traits/make_unsigned.h>
|
||||
|
|
|
|||
|
|
@ -1425,104 +1425,6 @@ struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<32> : public codecvt<char32_t
|
|||
}
|
||||
};
|
||||
|
||||
// template <class charT> class numpunct
|
||||
|
||||
template <class _CharT>
|
||||
class numpunct;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_EXPORTED_FROM_ABI numpunct<char> : public locale::facet {
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
explicit numpunct(size_t __refs = 0);
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
|
||||
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
~numpunct() override;
|
||||
virtual char_type do_decimal_point() const;
|
||||
virtual char_type do_thousands_sep() const;
|
||||
virtual string do_grouping() const;
|
||||
virtual string_type do_truename() const;
|
||||
virtual string_type do_falsename() const;
|
||||
|
||||
char_type __decimal_point_;
|
||||
char_type __thousands_sep_;
|
||||
string __grouping_;
|
||||
};
|
||||
|
||||
# if _LIBCPP_HAS_WIDE_CHARACTERS
|
||||
template <>
|
||||
class _LIBCPP_EXPORTED_FROM_ABI numpunct<wchar_t> : public locale::facet {
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
explicit numpunct(size_t __refs = 0);
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
|
||||
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
~numpunct() override;
|
||||
virtual char_type do_decimal_point() const;
|
||||
virtual char_type do_thousands_sep() const;
|
||||
virtual string do_grouping() const;
|
||||
virtual string_type do_truename() const;
|
||||
virtual string_type do_falsename() const;
|
||||
|
||||
char_type __decimal_point_;
|
||||
char_type __thousands_sep_;
|
||||
string __grouping_;
|
||||
};
|
||||
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
|
||||
|
||||
// template <class charT> class numpunct_byname
|
||||
|
||||
template <class _CharT>
|
||||
class numpunct_byname;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<char> : public numpunct<char> {
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
explicit numpunct_byname(const char* __nm, size_t __refs = 0);
|
||||
explicit numpunct_byname(const string& __nm, size_t __refs = 0);
|
||||
|
||||
protected:
|
||||
~numpunct_byname() override;
|
||||
};
|
||||
|
||||
# if _LIBCPP_HAS_WIDE_CHARACTERS
|
||||
template <>
|
||||
class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<wchar_t> : public numpunct<wchar_t> {
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
explicit numpunct_byname(const char* __nm, size_t __refs = 0);
|
||||
explicit numpunct_byname(const string& __nm, size_t __refs = 0);
|
||||
|
||||
protected:
|
||||
~numpunct_byname() override;
|
||||
};
|
||||
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
|
||||
|
||||
_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,104 @@ _LIBCPP_PUSH_MACROS
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
|
||||
|
||||
// template <class charT> class numpunct
|
||||
|
||||
template <class _CharT>
|
||||
class numpunct;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_EXPORTED_FROM_ABI numpunct<char> : public locale::facet {
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
explicit numpunct(size_t __refs = 0);
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
|
||||
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
~numpunct() override;
|
||||
virtual char_type do_decimal_point() const;
|
||||
virtual char_type do_thousands_sep() const;
|
||||
virtual string do_grouping() const;
|
||||
virtual string_type do_truename() const;
|
||||
virtual string_type do_falsename() const;
|
||||
|
||||
char_type __decimal_point_;
|
||||
char_type __thousands_sep_;
|
||||
string __grouping_;
|
||||
};
|
||||
|
||||
# if _LIBCPP_HAS_WIDE_CHARACTERS
|
||||
template <>
|
||||
class _LIBCPP_EXPORTED_FROM_ABI numpunct<wchar_t> : public locale::facet {
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
explicit numpunct(size_t __refs = 0);
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
|
||||
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
~numpunct() override;
|
||||
virtual char_type do_decimal_point() const;
|
||||
virtual char_type do_thousands_sep() const;
|
||||
virtual string do_grouping() const;
|
||||
virtual string_type do_truename() const;
|
||||
virtual string_type do_falsename() const;
|
||||
|
||||
char_type __decimal_point_;
|
||||
char_type __thousands_sep_;
|
||||
string __grouping_;
|
||||
};
|
||||
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
|
||||
|
||||
// template <class charT> class numpunct_byname
|
||||
|
||||
template <class _CharT>
|
||||
class numpunct_byname;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<char> : public numpunct<char> {
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
explicit numpunct_byname(const char* __nm, size_t __refs = 0);
|
||||
explicit numpunct_byname(const string& __nm, size_t __refs = 0);
|
||||
|
||||
protected:
|
||||
~numpunct_byname() override;
|
||||
};
|
||||
|
||||
# if _LIBCPP_HAS_WIDE_CHARACTERS
|
||||
template <>
|
||||
class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<wchar_t> : public numpunct<wchar_t> {
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
explicit numpunct_byname(const char* __nm, size_t __refs = 0);
|
||||
explicit numpunct_byname(const string& __nm, size_t __refs = 0);
|
||||
|
||||
protected:
|
||||
~numpunct_byname() override;
|
||||
};
|
||||
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
|
||||
|
||||
struct _LIBCPP_EXPORTED_FROM_ABI __num_get_base {
|
||||
static const int __num_get_buf_sz = 40;
|
||||
|
||||
|
|
|
|||
|
|
@ -378,13 +378,17 @@ format cstdint
|
|||
format cstdio
|
||||
format cstdlib
|
||||
format cstring
|
||||
format ctime
|
||||
format cwchar
|
||||
format cwctype
|
||||
format initializer_list
|
||||
format ios
|
||||
format iosfwd
|
||||
format limits
|
||||
format optional
|
||||
format ratio
|
||||
format stdexcept
|
||||
format streambuf
|
||||
format string
|
||||
format string_view
|
||||
format text_encoding
|
||||
|
|
@ -769,14 +773,18 @@ print cstdint
|
|||
print cstdio
|
||||
print cstdlib
|
||||
print cstring
|
||||
print ctime
|
||||
print cwchar
|
||||
print cwctype
|
||||
print format
|
||||
print initializer_list
|
||||
print ios
|
||||
print iosfwd
|
||||
print limits
|
||||
print optional
|
||||
print ratio
|
||||
print stdexcept
|
||||
print streambuf
|
||||
print string
|
||||
print string_view
|
||||
print text_encoding
|
||||
|
|
|
|||
|
|
|
@ -362,10 +362,12 @@ format cstring
|
|||
format cwchar
|
||||
format cwctype
|
||||
format initializer_list
|
||||
format ios
|
||||
format iosfwd
|
||||
format limits
|
||||
format optional
|
||||
format stdexcept
|
||||
format streambuf
|
||||
format string
|
||||
format string_view
|
||||
format text_encoding
|
||||
|
|
@ -719,10 +721,12 @@ print cwchar
|
|||
print cwctype
|
||||
print format
|
||||
print initializer_list
|
||||
print ios
|
||||
print iosfwd
|
||||
print limits
|
||||
print optional
|
||||
print stdexcept
|
||||
print streambuf
|
||||
print string
|
||||
print string_view
|
||||
print text_encoding
|
||||
|
|
@ -1051,10 +1055,12 @@ thread ctime
|
|||
thread cwchar
|
||||
thread cwctype
|
||||
thread initializer_list
|
||||
thread ios
|
||||
thread iosfwd
|
||||
thread limits
|
||||
thread ratio
|
||||
thread stdexcept
|
||||
thread streambuf
|
||||
thread string
|
||||
thread string_view
|
||||
thread text_encoding
|
||||
|
|
|
|||
|
|
|
@ -33,6 +33,7 @@
|
|||
// void vprint_nonunicode(ostream& os, string_view fmt, format_args args);
|
||||
|
||||
#include <cassert>
|
||||
#include <locale>
|
||||
#include <ostream>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@
|
|||
#include <format>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <locale>
|
||||
#include <vector>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
|
|
|||
Loading…
Reference in a new issue