// Locale support -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
#pragma GCC system_header
-_GLIBCXX_BEGIN_NAMESPACE(std)
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Routine to access a cache for the facet. If the cache didn't
// exist before, it gets constructed on the fly.
void
__numpunct_cache<_CharT>::_M_cache(const locale& __loc)
{
- _M_allocated = true;
-
const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
char* __grouping = 0;
_CharT* __falsename = 0;
__try
{
- _M_grouping_size = __np.grouping().size();
+ const string& __g = __np.grouping();
+ _M_grouping_size = __g.size();
__grouping = new char[_M_grouping_size];
- __np.grouping().copy(__grouping, _M_grouping_size);
- _M_grouping = __grouping;
+ __g.copy(__grouping, _M_grouping_size);
_M_use_grouping = (_M_grouping_size
- && static_cast<signed char>(_M_grouping[0]) > 0
- && (_M_grouping[0]
+ && static_cast<signed char>(__grouping[0]) > 0
+ && (__grouping[0]
!= __gnu_cxx::__numeric_traits<char>::__max));
- _M_truename_size = __np.truename().size();
+ const basic_string<_CharT>& __tn = __np.truename();
+ _M_truename_size = __tn.size();
__truename = new _CharT[_M_truename_size];
- __np.truename().copy(__truename, _M_truename_size);
- _M_truename = __truename;
+ __tn.copy(__truename, _M_truename_size);
- _M_falsename_size = __np.falsename().size();
+ const basic_string<_CharT>& __fn = __np.falsename();
+ _M_falsename_size = __fn.size();
__falsename = new _CharT[_M_falsename_size];
- __np.falsename().copy(__falsename, _M_falsename_size);
- _M_falsename = __falsename;
+ __fn.copy(__falsename, _M_falsename_size);
_M_decimal_point = __np.decimal_point();
_M_thousands_sep = __np.thousands_sep();
__ct.widen(__num_base::_S_atoms_in,
__num_base::_S_atoms_in
+ __num_base::_S_iend, _M_atoms_in);
+
+ _M_grouping = __grouping;
+ _M_truename = __truename;
+ _M_falsename = __falsename;
+ _M_allocated = true;
}
__catch(...)
{
__verify_grouping(const char* __grouping, size_t __grouping_size,
const string& __grouping_tmp) throw ();
-_GLIBCXX_BEGIN_LDBL_NAMESPACE
+_GLIBCXX_BEGIN_NAMESPACE_LDBL
template<typename _CharT, typename _InIter>
+ _GLIBCXX_DEFAULT_ABI_TAG
_InIter
num_get<_CharT, _InIter>::
_M_extract_float(_InIter __beg, _InIter __end, ios_base& __io,
template<typename _CharT, typename _InIter>
template<typename _ValueT>
+ _GLIBCXX_DEFAULT_ABI_TAG
_InIter
num_get<_CharT, _InIter>::
_M_extract_int(_InIter __beg, _InIter __end, ios_base& __io,
__len = static_cast<int>(__w);
}
-_GLIBCXX_END_LDBL_NAMESPACE
+_GLIBCXX_END_NAMESPACE_LDBL
template<typename _CharT, typename _ValueT>
int
return __bufend - __buf;
}
-_GLIBCXX_BEGIN_LDBL_NAMESPACE
+_GLIBCXX_BEGIN_NAMESPACE_LDBL
template<typename _CharT, typename _OutIter>
void
__num_base::_S_format_float(__io, __fbuf, __mod);
#ifdef _GLIBCXX_USE_C99
+ // Precision is always used except for hexfloat format.
+ const bool __use_prec =
+ (__io.flags() & ios_base::floatfield) != ios_base::floatfield;
+
// First try a buffer perhaps big enough (most probably sufficient
// for non-ios_base::fixed outputs)
int __cs_size = __max_digits * 3;
char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
- __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
- __fbuf, __prec, __v);
+ if (__use_prec)
+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
+ __fbuf, __prec, __v);
+ else
+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
+ __fbuf, __v);
// If the buffer was not large enough, try again with the correct size.
if (__len >= __cs_size)
{
__cs_size = __len + 1;
__cs = static_cast<char*>(__builtin_alloca(__cs_size));
- __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
- __fbuf, __prec, __v);
+ if (__use_prec)
+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
+ __fbuf, __prec, __v);
+ else
+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
+ __fbuf, __v);
}
#else
// Consider the possibility of long ios_base::fixed outputs
return __s;
}
-_GLIBCXX_END_LDBL_NAMESPACE
+_GLIBCXX_END_NAMESPACE_LDBL
// Construct correctly padded string, as per 22.2.2.2.2
// Assumes
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
- extern template class numpunct<char>;
- extern template class numpunct_byname<char>;
- extern template class _GLIBCXX_LDBL_NAMESPACE num_get<char>;
- extern template class _GLIBCXX_LDBL_NAMESPACE num_put<char>;
+ extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct<char>;
+ extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct_byname<char>;
+ extern template class _GLIBCXX_NAMESPACE_LDBL num_get<char>;
+ extern template class _GLIBCXX_NAMESPACE_LDBL num_put<char>;
extern template class ctype_byname<char>;
extern template
has_facet<num_get<char> >(const locale&);
#ifdef _GLIBCXX_USE_WCHAR_T
- extern template class numpunct<wchar_t>;
- extern template class numpunct_byname<wchar_t>;
- extern template class _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;
- extern template class _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;
+ extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct<wchar_t>;
+ extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct_byname<wchar_t>;
+ extern template class _GLIBCXX_NAMESPACE_LDBL num_get<wchar_t>;
+ extern template class _GLIBCXX_NAMESPACE_LDBL num_put<wchar_t>;
extern template class ctype_byname<wchar_t>;
extern template
#endif
#endif
-_GLIBCXX_END_NAMESPACE
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
#endif