Professional Documents
Culture Documents
#define _LOCALE_FACETS_TCC 1
namespace std
{
template<typename _Facet>
locale
locale::combine(const locale& __other) const
{
_Impl* __tmp = new _Impl(*_M_impl, 1);
try
{
__tmp->_M_replace_facet(__other._M_impl, &_Facet::id);
}
catch(...)
{
__tmp->_M_remove_reference();
__throw_exception_again;
}
return locale(__tmp);
}
/**
* @brief Test for the presence of a facet.
*
* has_facet tests the locale argument for the presence of the facet type
* provided as the template parameter. Facets derived from the facet
* parameter will also return true.
*
* @param Facet The facet type to test the presence of.
* @param locale The locale to test.
* @return true if locale contains a facet of type Facet, else false.
*/
template<typename _Facet>
inline bool
has_facet(const locale& __loc) throw()
{
const size_t __i = _Facet::id._M_id();
const locale::facet** __facets = __loc._M_impl->_M_facets;
return (__i < __loc._M_impl->_M_facets_size && __facets[__i]);
}
/**
* @brief Return a facet.
*
* use_facet looks for and returns a reference to a facet of type Facet
* where Facet is the template parameter. If has_facet(locale) is true,
* there is a suitable facet to return. It throws std::bad_cast if the
* locale doesn't contain a facet of type Facet.
*
* @param Facet The facet type to access.
* @param locale The locale to use.
* @return Reference to facet of type Facet.
* @throw std::bad_cast if locale doesn't contain a facet of type Facet.
*/
template<typename _Facet>
inline const _Facet&
use_facet(const locale& __loc)
{
const size_t __i = _Facet::id._M_id();
const locale::facet** __facets = __loc._M_impl->_M_facets;
if (!(__i < __loc._M_impl->_M_facets_size && __facets[__i]))
__throw_bad_cast();
return static_cast<const _Facet&>(*__facets[__i]);
}
// Specializations.
template<typename _CharT>
struct __use_cache<__numpunct_cache<_CharT> >
{
const __numpunct_cache<_CharT>*
operator() (const locale& __loc) const
{
const size_t __i = numpunct<_CharT>::id._M_id();
const locale::facet** __caches = __loc._M_impl->_M_caches;
if (!__caches[__i])
{
__numpunct_cache<_CharT>* __tmp = NULL;
try
{
__tmp = new __numpunct_cache<_CharT>;
__tmp->_M_cache(__loc);
}
catch(...)
{
delete __tmp;
__throw_exception_again;
}
__loc._M_impl->_M_install_cache(__tmp, __i);
}
return static_cast<const __numpunct_cache<_CharT>*>(__caches[__i]);
}
};
template<typename _CharT>
void
__numpunct_cache<_CharT>::_M_cache(const locale& __loc)
{
_M_allocated = true;
_M_grouping_size = __np.grouping().size();
char* __grouping = new char[_M_grouping_size];
__np.grouping().copy(__grouping, _M_grouping_size);
_M_grouping = __grouping;
_M_use_grouping = _M_grouping_size && __np.grouping()[0] != 0;
_M_truename_size = __np.truename().size();
_CharT* __truename = new _CharT[_M_truename_size];
__np.truename().copy(__truename, _M_truename_size);
_M_truename = __truename;
_M_falsename_size = __np.falsename().size();
_CharT* __falsename = new _CharT[_M_falsename_size];
__np.falsename().copy(__falsename, _M_falsename_size);
_M_falsename = __falsename;
_M_decimal_point = __np.decimal_point();
_M_thousands_sep = __np.thousands_sep();
_M_grouping_size = __mp.grouping().size();
char* __grouping = new char[_M_grouping_size];
__mp.grouping().copy(__grouping, _M_grouping_size);
_M_grouping = __grouping;
_M_use_grouping = _M_grouping_size && __mp.grouping()[0] != 0;
_M_decimal_point = __mp.decimal_point();
_M_thousands_sep = __mp.thousands_sep();
_M_frac_digits = __mp.frac_digits();
_M_curr_symbol_size = __mp.curr_symbol().size();
_CharT* __curr_symbol = new _CharT[_M_curr_symbol_size];
__mp.curr_symbol().copy(__curr_symbol, _M_curr_symbol_size);
_M_curr_symbol = __curr_symbol;
_M_positive_sign_size = __mp.positive_sign().size();
_CharT* __positive_sign = new _CharT[_M_positive_sign_size];
__mp.positive_sign().copy(__positive_sign, _M_positive_sign_size);
_M_positive_sign = __positive_sign;
_M_negative_sign_size = __mp.negative_sign().size();
_CharT* __negative_sign = new _CharT[_M_negative_sign_size];
__mp.negative_sign().copy(__negative_sign, _M_negative_sign_size);
_M_negative_sign = __negative_sign;
_M_pos_format = __mp.pos_format();
_M_neg_format = __mp.neg_format();
if (!std::__verify_grouping(__lc->_M_grouping,
__lc->_M_grouping_size,
__found_grouping))
__err |= ios_base::failbit;
}
// Finish up.
if (__beg == __end)
__err |= ios_base::eofbit;
return __beg;
}
// Extract.
string __found_grouping;
if (__lc->_M_use_grouping)
__found_grouping.reserve(32);
int __sep_pos = 0;
bool __overflow = false;
_ValueT __result = 0;
const char_type* __lit_zero = __lit + __num_base::_S_izero;
if (__negative)
{
const _ValueT __min = numeric_limits<_ValueT>::min() / __base;
for (; __beg != __end; ++__beg)
{
// According to 22.2.2.1.2, p8-9, first look for thousands_sep
// and decimal_point.
const char_type __c = *__beg;
const char_type* __q = __traits_type::find(__lit_zero,
__len, __c);
if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
{
// NB: Thousands separator at the beginning of a string
// is a no-no, as is two consecutive thousands separators.
if (__sep_pos)
{
__found_grouping += static_cast<char>(__sep_pos);
__sep_pos = 0;
}
else
{
__err |= ios_base::failbit;
break;
}
}
else if (__c == __lc->_M_decimal_point)
break;
else if (__q != 0)
{
int __digit = __q - __lit_zero;
if (__digit > 15)
__digit -= 6;
if (__result < __min)
__overflow = true;
else
{
const _ValueT __new_result = __result * __base
- __digit;
__overflow |= __new_result > __result;
__result = __new_result;
++__sep_pos;
__found_num = true;
}
}
else
// Not a valid input item.
break;
}
}
else
{
const _ValueT __max = numeric_limits<_ValueT>::max() / __base;
for (; __beg != __end; ++__beg)
{
const char_type __c = *__beg;
const char_type* __q = __traits_type::find(__lit_zero,
__len, __c);
if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
{
if (__sep_pos)
{
__found_grouping += static_cast<char>(__sep_pos);
__sep_pos = 0;
}
else
{
__err |= ios_base::failbit;
break;
}
}
else if (__c == __lc->_M_decimal_point)
break;
else if (__q != 0)
{
int __digit = __q - __lit_zero;
if (__digit > 15)
__digit -= 6;
if (__result > __max)
__overflow = true;
else
{
const _ValueT __new_result = __result * __base
+ __digit;
__overflow |= __new_result < __result;
__result = __new_result;
++__sep_pos;
__found_num = true;
}
}
else
break;
}
}
if (!std::__verify_grouping(__lc->_M_grouping,
__lc->_M_grouping_size,
__found_grouping))
__err |= ios_base::failbit;
}
if (__beg == __end)
__err |= ios_base::eofbit;
return __beg;
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 17. Bad bool parsing
template<typename _CharT, typename _InIter>
_InIter
num_get<_CharT, _InIter>::
do_get(iter_type __beg, iter_type __end, ios_base& __io,
ios_base::iostate& __err, bool& __v) const
{
if (!(__io.flags() & ios_base::boolalpha))
{
// Parse bool values as long.
// NB: We can't just call do_get(long) here, as it might
// refer to a derived class.
long __l = -1;
__beg = _M_extract_int(__beg, __end, __io, __err, __l);
if (__l == 0 || __l == 1)
__v = __l;
else
__err |= ios_base::failbit;
}
else
{
// Parse bool values as alphanumeric.
typedef char_traits<_CharT> __traits_type;
typedef typename numpunct<_CharT>::__cache_type __cache_type;
__use_cache<__cache_type> __uc;
const locale& __loc = __io._M_getloc();
const __cache_type* __lc = __uc(__loc);
if (__testt)
if (__n < __lc->_M_truename_size)
__testt = *__beg == __lc->_M_truename[__n];
else
break;
if (__beg == __end)
__err |= ios_base::eofbit;
}
return __beg;
}
#ifdef _GLIBCXX_USE_LONG_LONG
template<typename _CharT, typename _InIter>
_InIter
num_get<_CharT, _InIter>::
do_get(iter_type __beg, iter_type __end, ios_base& __io,
ios_base::iostate& __err, long long& __v) const
{ return _M_extract_int(__beg, __end, __io, __err, __v); }
// For use by integer and floating-point types after they have been
// converted into a char_type string.
template<typename _CharT, typename _OutIter>
void
num_put<_CharT, _OutIter>::
_M_pad(_CharT __fill, streamsize __w, ios_base& __io,
_CharT* __new, const _CharT* __cs, int& __len) const
{
// [22.2.2.2.2] Stage 3.
// If necessary, pad.
__pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new, __cs,
__w, __len, true);
__len = static_cast<int>(__w);
}
template<typename _CharT>
inline int
__int_to_char(_CharT* __bufend, unsigned long __v, const _CharT* __lit,
ios_base::fmtflags __flags)
{
// About showpos, see Table 60 and C99 7.19.6.1, p6 (+).
return __int_to_char(__bufend, __v, __lit,
__flags & ~ios_base::showpos, false);
}
#ifdef _GLIBCXX_USE_LONG_LONG
template<typename _CharT>
inline int
__int_to_char(_CharT* __bufend, long long __v, const _CharT* __lit,
ios_base::fmtflags __flags)
{
unsigned long long __ull = static_cast<unsigned long long>(__v);
bool __neg = false;
if (__v < 0)
{
__ull = -__ull;
__neg = true;
}
return __int_to_char(__bufend, __ull, __lit, __flags, __neg);
}
template<typename _CharT>
inline int
__int_to_char(_CharT* __bufend, unsigned long long __v,
const _CharT* __lit, ios_base::fmtflags __flags)
{ return __int_to_char(__bufend, __v, __lit,
__flags & ~ios_base::showpos, false); }
#endif
// Pad.
const streamsize __w = __io.width();
if (__w > static_cast<streamsize>(__len))
{
_CharT* __cs3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
* __w));
_M_pad(__fill, __w, __io, __cs3, __cs, __len);
__cs = __cs3;
}
__io.width(0);
// [22.2.2.2.2] Stage 4.
// Write resulting, fully-formatted string to output iterator.
return std::__write(__s, __cs, __len);
}
#ifdef _GLIBCXX_USE_C99
// 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));
// 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(__cs, __cs_size, __fbuf, __v,
_S_get_c_locale(), __prec);
}
#else
// Consider the possibility of long ios_base::fixed outputs
const bool __fixed = __io.flags() & ios_base::fixed;
const int __max_exp = numeric_limits<_ValueT>::max_exponent10;
// Pad.
const streamsize __w = __io.width();
if (__w > static_cast<streamsize>(__len))
{
_CharT* __ws3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
* __w));
_M_pad(__fill, __w, __io, __ws3, __ws, __len);
__ws = __ws3;
}
__io.width(0);
// [22.2.2.2.2] Stage 4.
// Write resulting, fully-formatted string to output iterator.
return std::__write(__s, __ws, __len);
}
template<typename _CharT, typename _OutIter>
_OutIter
num_put<_CharT, _OutIter>::
do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const
{
const ios_base::fmtflags __flags = __io.flags();
if ((__flags & ios_base::boolalpha) == 0)
{
const long __l = __v;
__s = _M_insert_int(__s, __io, __fill, __l);
}
else
{
typedef typename numpunct<_CharT>::__cache_type __cache_type;
__use_cache<__cache_type> __uc;
const locale& __loc = __io._M_getloc();
const __cache_type* __lc = __uc(__loc);
#ifdef _GLIBCXX_USE_LONG_LONG
template<typename _CharT, typename _OutIter>
_OutIter
num_put<_CharT, _OutIter>::
do_put(iter_type __s, ios_base& __b, char_type __fill, long long __v) const
{ return _M_insert_int(__s, __b, __fill, __v); }
template<typename _CharT, typename _OutIter>
_OutIter
num_put<_CharT, _OutIter>::
do_put(iter_type __s, ios_base& __io, char_type __fill,
unsigned long long __v) const
{ return _M_insert_int(__s, __io, __fill, __v); }
#endif
__use_cache<__cache_type> __uc;
const __cache_type* __lc = __uc(__loc);
const char_type* __lit = __lc->_M_atoms;
// Deduced sign.
bool __negative = false;
// Sign size.
size_type __sign_size = 0;
// True if sign is mandatory.
const bool __mandatory_sign = (__lc->_M_positive_sign_size
&& __lc->_M_negative_sign_size);
// String of grouping info from thousands_sep plucked from __units.
string __grouping_tmp;
if (__lc->_M_use_grouping)
__grouping_tmp.reserve(32);
// Last position before the decimal point.
int __last_pos = 0;
// Separator positions, then, possibly, fractional digits.
int __n = 0;
// If input iterator is in a valid state.
bool __testvalid = true;
// Flag marking when a decimal point is found.
bool __testdecfound = false;
if (__i != __sign_size)
__testvalid = false;
}
if (__testvalid)
{
// Strip leading zeros.
if (__res.size() > 1)
{
const size_type __first = __res.find_first_not_of('0');
const bool __only_zeros = __first == string::npos;
if (__first)
__res.erase(0, __only_zeros ? __res.size() - 1 : __first);
}
// 22.2.6.1.2, p4
if (__negative && __res[0] != '0')
__res.insert(__res.begin(), '-');
return __beg;
}
return __ret;
}
__use_cache<__cache_type> __uc;
const __cache_type* __lc = __uc(__loc);
const char_type* __lit = __lc->_M_atoms;
money_base::pattern __p;
const char_type* __sign;
size_type __sign_size;
if (*__beg != __lit[money_base::_S_minus])
{
__p = __lc->_M_pos_format;
__sign = __lc->_M_positive_sign;
__sign_size = __lc->_M_positive_sign_size;
}
else
{
__p = __lc->_M_neg_format;
__sign = __lc->_M_negative_sign;
__sign_size = __lc->_M_negative_sign_size;
if (__digits.size())
++__beg;
}
// Look for valid numbers in the ctype facet within input digits.
size_type __len = __ctype.scan_not(ctype_base::digit, __beg,
__beg + __digits.size()) - __beg;
if (__len)
{
// Assume valid input, and attempt to format.
// Break down input numbers into base components, as follows:
// final_value = grouped units + (decimal point) + (digits)
string_type __value;
__value.reserve(2 * __len);
string_type __res;
__res.reserve(2 * __len);
// Expand a strftime format string and parse it. E.g., do_get_date() may
// pass %m/%d/%Y => extracted characters.
template<typename _CharT, typename _InIter>
_InIter
time_get<_CharT, _InIter>::
_M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io,
ios_base::iostate& __err, tm* __tm,
const _CharT* __format) const
{
const locale& __loc = __io._M_getloc();
const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
const size_t __len = char_traits<_CharT>::length(__format);
for (size_t __i = 0; __beg != __end && __i < __len && !__err; ++__i)
{
if (__ctype.narrow(__format[__i], 0) == '%')
{
// Verify valid formatting code, attempt to extract.
char __c = __ctype.narrow(__format[++__i], 0);
int __mem = 0;
if (__c == 'E' || __c == 'O')
__c = __ctype.narrow(__format[++__i], 0);
switch (__c)
{
const char* __cs;
_CharT __wcs[10];
case 'a':
// Abbreviated weekday name [tm_wday]
const char_type* __days1[7];
__tp._M_days_abbreviated(__days1);
__beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days1,
7, __io, __err);
break;
case 'A':
// Weekday name [tm_wday].
const char_type* __days2[7];
__tp._M_days(__days2);
__beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days2,
7, __io, __err);
break;
case 'h':
case 'b':
// Abbreviated month name [tm_mon]
const char_type* __months1[12];
__tp._M_months_abbreviated(__months1);
__beg = _M_extract_name(__beg, __end, __tm->tm_mon,
__months1, 12, __io, __err);
break;
case 'B':
// Month name [tm_mon].
const char_type* __months2[12];
__tp._M_months(__months2);
__beg = _M_extract_name(__beg, __end, __tm->tm_mon,
__months2, 12, __io, __err);
break;
case 'c':
// Default time and date representation.
const char_type* __dt[2];
__tp._M_date_time_formats(__dt);
__beg = _M_extract_via_format(__beg, __end, __io, __err,
__tm, __dt[0]);
break;
case 'd':
// Day [01, 31]. [tm_mday]
__beg = _M_extract_num(__beg, __end, __tm->tm_mday, 1, 31, 2,
__io, __err);
break;
case 'e':
// Day [1, 31], with single digits preceded by
// space. [tm_mday]
if (__ctype.is(ctype_base::space, *__beg))
__beg = _M_extract_num(++__beg, __end, __tm->tm_mday, 1, 9,
1, __io, __err);
else
__beg = _M_extract_num(__beg, __end, __tm->tm_mday, 10, 31,
2, __io, __err);
break;
case 'D':
// Equivalent to %m/%d/%y.[tm_mon, tm_mday, tm_year]
__cs = "%m/%d/%y";
__ctype.widen(__cs, __cs + 9, __wcs);
__beg = _M_extract_via_format(__beg, __end, __io, __err,
__tm, __wcs);
break;
case 'H':
// Hour [00, 23]. [tm_hour]
__beg = _M_extract_num(__beg, __end, __tm->tm_hour, 0, 23, 2,
__io, __err);
break;
case 'I':
// Hour [01, 12]. [tm_hour]
__beg = _M_extract_num(__beg, __end, __tm->tm_hour, 1, 12, 2,
__io, __err);
break;
case 'm':
// Month [01, 12]. [tm_mon]
__beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2,
__io, __err);
if (!__err)
__tm->tm_mon = __mem - 1;
break;
case 'M':
// Minute [00, 59]. [tm_min]
__beg = _M_extract_num(__beg, __end, __tm->tm_min, 0, 59, 2,
__io, __err);
break;
case 'n':
if (__ctype.narrow(*__beg, 0) == '\n')
++__beg;
else
__err |= ios_base::failbit;
break;
case 'R':
// Equivalent to (%H:%M).
__cs = "%H:%M";
__ctype.widen(__cs, __cs + 6, __wcs);
__beg = _M_extract_via_format(__beg, __end, __io, __err,
__tm, __wcs);
break;
case 'S':
// Seconds.
__beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 59, 2,
__io, __err);
break;
case 't':
if (__ctype.narrow(*__beg, 0) == '\t')
++__beg;
else
__err |= ios_base::failbit;
break;
case 'T':
// Equivalent to (%H:%M:%S).
__cs = "%H:%M:%S";
__ctype.widen(__cs, __cs + 9, __wcs);
__beg = _M_extract_via_format(__beg, __end, __io, __err,
__tm, __wcs);
break;
case 'x':
// Locale's date.
const char_type* __dates[2];
__tp._M_date_formats(__dates);
__beg = _M_extract_via_format(__beg, __end, __io, __err,
__tm, __dates[0]);
break;
case 'X':
// Locale's time.
const char_type* __times[2];
__tp._M_time_formats(__times);
__beg = _M_extract_via_format(__beg, __end, __io, __err,
__tm, __times[0]);
break;
case 'y':
case 'C': // C99
// Two digit year. [tm_year]
__beg = _M_extract_num(__beg, __end, __tm->tm_year, 0, 99, 2,
__io, __err);
break;
case 'Y':
// Year [1900). [tm_year]
__beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4,
__io, __err);
if (!__err)
__tm->tm_year = __mem - 1900;
break;
case 'Z':
// Timezone info.
if (__ctype.is(ctype_base::upper, *__beg))
{
int __tmp;
__beg = _M_extract_name(__beg, __end, __tmp,
__timepunct_cache<_CharT>::_S_timezones,
14, __io, __err);
++__min;
size_t __i = 0;
int __value = 0;
for (; __beg != __end && __i < __len; ++__beg, ++__i)
{
const char __c = __ctype.narrow(*__beg, '*');
if (__c >= '0' && __c <= '9')
{
__value = __value * 10 + (__c - '0');
const int __valuec = __value * __mult;
if (__valuec > __max || __valuec + __mult < __min)
break;
__mult /= 10;
}
else
break;
}
if (__i == __len)
__member = __value;
else
__err |= ios_base::failbit;
return __beg;
}
// Assumptions:
// All elements in __names are unique.
template<typename _CharT, typename _InIter>
_InIter
time_get<_CharT, _InIter>::
_M_extract_name(iter_type __beg, iter_type __end, int& __member,
const _CharT** __names, size_t __indexlen,
ios_base& __io, ios_base::iostate& __err) const
{
typedef char_traits<_CharT> __traits_type;
const locale& __loc = __io._M_getloc();
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
if (__nmatches == 1)
{
// Make sure found name is completely extracted.
++__pos;
++__beg;
__name = __names[__matches[0]];
const size_t __len = __traits_type::length(__name);
while (__pos < __len && __beg != __end && __name[__pos] == *__beg)
++__beg, ++__pos;
if (__len == __pos)
__member = __matches[0];
else
__testvalid = false;
}
else
__testvalid = false;
if (!__testvalid)
__err |= ios_base::failbit;
return __beg;
}
if (__beg == __end)
__err |= ios_base::eofbit;
return __beg;
}
size_t __i = 0;
int __value = 0;
for (; __beg != __end && __i < 4; ++__beg, ++__i)
{
const char __c = __ctype.narrow(*__beg, '*');
if (__c >= '0' && __c <= '9')
__value = __value * 10 + (__c - '0');
else
break;
}
if (__i == 2 || __i == 4)
__tm->tm_year = __i == 2 ? __value : __value - 1900;
else
__err |= ios_base::failbit;
if (__beg == __end)
__err |= ios_base::eofbit;
return __beg;
}
template<typename _CharT>
int
collate<_CharT>::
do_compare(const _CharT* __lo1, const _CharT* __hi1,
const _CharT* __lo2, const _CharT* __hi2) const
{
// strcoll assumes zero-terminated strings so we make a copy
// and then put a zero at the end.
const string_type __one(__lo1, __hi1);
const string_type __two(__lo2, __hi2);
__p += char_traits<_CharT>::length(__p);
__q += char_traits<_CharT>::length(__q);
if (__p == __pend && __q == __qend)
return 0;
else if (__p == __pend)
return -1;
else if (__q == __qend)
return 1;
__p++;
__q++;
}
}
template<typename _CharT>
typename collate<_CharT>::string_type
collate<_CharT>::
do_transform(const _CharT* __lo, const _CharT* __hi) const
{
// strxfrm assumes zero-terminated strings so we make a copy
string_type __str(__lo, __hi);
string_type __ret;
__ret.append(__c, __res);
__p += char_traits<_CharT>::length(__p);
if (__p == __pend)
return __ret;
__p++;
__ret.push_back(_CharT());
}
}
template<typename _CharT>
long
collate<_CharT>::
do_hash(const _CharT* __lo, const _CharT* __hi) const
{
unsigned long __val = 0;
for (; __lo < __hi; ++__lo)
__val = *__lo + ((__val << 7) |
(__val >> (numeric_limits<unsigned long>::digits - 7)));
return static_cast<long>(__val);
}
// Padding last.
if (__adjust == ios_base::left)
{
_Traits::copy(__news, const_cast<_CharT*>(__olds), __oldlen);
_Traits::assign(__news + __oldlen, __plen, __fill);
return;
}
size_t __mod = 0;
if (__adjust == ios_base::internal && __num)
{
// Pad after the sign, if there is one.
// Pad after 0[xX], if there is one.
// Who came up with these rules, anyway? Jeeze.
const locale& __loc = __io._M_getloc();
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
bool
__verify_grouping(const char* __grouping, size_t __grouping_size,
const string& __grouping_tmp)
{
const size_t __n = __grouping_tmp.size() - 1;
const size_t __min = std::min(__n, __grouping_size - 1);
size_t __i = __n;
bool __test = true;
extern template
const codecvt<char, char, mbstate_t>&
use_facet<codecvt<char, char, mbstate_t> >(const locale&);
extern template
const collate<char>&
use_facet<collate<char> >(const locale&);
extern template
const numpunct<char>&
use_facet<numpunct<char> >(const locale&);
extern template
const num_put<char>&
use_facet<num_put<char> >(const locale&);
extern template
const num_get<char>&
use_facet<num_get<char> >(const locale&);
extern template
const moneypunct<char, true>&
use_facet<moneypunct<char, true> >(const locale&);
extern template
const moneypunct<char, false>&
use_facet<moneypunct<char, false> >(const locale&);
extern template
const money_put<char>&
use_facet<money_put<char> >(const locale&);
extern template
const money_get<char>&
use_facet<money_get<char> >(const locale&);
extern template
const __timepunct<char>&
use_facet<__timepunct<char> >(const locale&);
extern template
const time_put<char>&
use_facet<time_put<char> >(const locale&);
extern template
const time_get<char>&
use_facet<time_get<char> >(const locale&);
extern template
const messages<char>&
use_facet<messages<char> >(const locale&);
extern template
bool
has_facet<ctype<char> >(const locale&);
extern template
bool
has_facet<codecvt<char, char, mbstate_t> >(const locale&);
extern template
bool
has_facet<collate<char> >(const locale&);
extern template
bool
has_facet<numpunct<char> >(const locale&);
extern template
bool
has_facet<num_put<char> >(const locale&);
extern template
bool
has_facet<num_get<char> >(const locale&);
extern template
bool
has_facet<moneypunct<char> >(const locale&);
extern template
bool
has_facet<money_put<char> >(const locale&);
extern template
bool
has_facet<money_get<char> >(const locale&);
extern template
bool
has_facet<__timepunct<char> >(const locale&);
extern template
bool
has_facet<time_put<char> >(const locale&);
extern template
bool
has_facet<time_get<char> >(const locale&);
extern template
bool
has_facet<messages<char> >(const locale&);
#ifdef _GLIBCXX_USE_WCHAR_T
extern template class moneypunct<wchar_t, false>;
extern template class moneypunct<wchar_t, true>;
extern template class moneypunct_byname<wchar_t, false>;
extern template class moneypunct_byname<wchar_t, true>;
extern template class money_get<wchar_t>;
extern template class money_put<wchar_t>;
extern template class numpunct<wchar_t>;
extern template class numpunct_byname<wchar_t>;
extern template class num_get<wchar_t>;
extern template class num_put<wchar_t>;
extern template class __timepunct<wchar_t>;
extern template class time_put<wchar_t>;
extern template class time_put_byname<wchar_t>;
extern template class time_get<wchar_t>;
extern template class time_get_byname<wchar_t>;
extern template class messages<wchar_t>;
extern template class messages_byname<wchar_t>;
extern template class ctype_byname<wchar_t>;
extern template class codecvt_byname<wchar_t, char, mbstate_t>;
extern template class collate<wchar_t>;
extern template class collate_byname<wchar_t>;
extern template
const codecvt<wchar_t, char, mbstate_t>&
use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);
extern template
const collate<wchar_t>&
use_facet<collate<wchar_t> >(const locale&);
extern template
const numpunct<wchar_t>&
use_facet<numpunct<wchar_t> >(const locale&);
extern template
const num_put<wchar_t>&
use_facet<num_put<wchar_t> >(const locale&);
extern template
const num_get<wchar_t>&
use_facet<num_get<wchar_t> >(const locale&);
extern template
const moneypunct<wchar_t, true>&
use_facet<moneypunct<wchar_t, true> >(const locale&);
extern template
const moneypunct<wchar_t, false>&
use_facet<moneypunct<wchar_t, false> >(const locale&);
extern template
const money_put<wchar_t>&
use_facet<money_put<wchar_t> >(const locale&);
extern template
const money_get<wchar_t>&
use_facet<money_get<wchar_t> >(const locale&);
extern template
const __timepunct<wchar_t>&
use_facet<__timepunct<wchar_t> >(const locale&);
extern template
const time_put<wchar_t>&
use_facet<time_put<wchar_t> >(const locale&);
extern template
const time_get<wchar_t>&
use_facet<time_get<wchar_t> >(const locale&);
extern template
const messages<wchar_t>&
use_facet<messages<wchar_t> >(const locale&);
extern template
bool
has_facet<ctype<wchar_t> >(const locale&);
extern template
bool
has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
extern template
bool
has_facet<collate<wchar_t> >(const locale&);
extern template
bool
has_facet<numpunct<wchar_t> >(const locale&);
extern template
bool
has_facet<num_put<wchar_t> >(const locale&);
extern template
bool
has_facet<num_get<wchar_t> >(const locale&);
extern template
bool
has_facet<moneypunct<wchar_t> >(const locale&);
extern template
bool
has_facet<money_put<wchar_t> >(const locale&);
extern template
bool
has_facet<money_get<wchar_t> >(const locale&);
extern template
bool
has_facet<__timepunct<wchar_t> >(const locale&);
extern template
bool
has_facet<time_put<wchar_t> >(const locale&);
extern template
bool
has_facet<time_get<wchar_t> >(const locale&);
extern template
bool
has_facet<messages<wchar_t> >(const locale&);
#endif
#endif
} // namespace std
#endif