⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 locale_facets.tcc

📁 俄罗斯高人Mamaich的Pocket gcc编译器(运行在PocketPC上)的全部源代码。
💻 TCC
📖 第 1 页 / 共 5 页
字号:
          string __xtrc;          int __base;          __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);	  unsigned long __ul; 	  __convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);	  if (!(__err & ios_base::failbit) && __ul <= 1)	    __v = __ul;	  else             __err |= ios_base::failbit;        }      // Parse bool values as alphanumeric      else        {	  typedef char_traits<_CharT>	      	__traits_type;	  typedef basic_string<_CharT>   	__string_type;          locale __loc = __io.getloc();	  const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc); 	  const __string_type __true = __np.truename();	  const __string_type __false = __np.falsename();          const char_type* __trues = __true.c_str();          const char_type* __falses = __false.c_str();          const size_t __truen =  __true.size() - 1;          const size_t __falsen =  __false.size() - 1;          for (size_t __n = 0; __beg != __end; ++__n)            {              char_type __c = *__beg++;              bool __testf = __n <= __falsen 		             ? __traits_type::eq(__c, __falses[__n]) : false;              bool __testt = __n <= __truen 		             ? __traits_type::eq(__c, __trues[__n]) : false;              if (!(__testf || __testt))                {                  __err |= ios_base::failbit;                  break;                }              else if (__testf && __n == __falsen)                {                  __v = 0;                  break;                }              else if (__testt && __n == __truen)                {                  __v = 1;                  break;                }            }          if (__beg == __end)            __err |= ios_base::eofbit;        }      return __beg;    }#endif  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& __v) const    {      string __xtrc;      int __base;      __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);      return __beg;    }  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, unsigned short& __v) const    {      string __xtrc;      int __base;      __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);      unsigned long __ul;      __convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);      if (!(__err & ios_base::failbit) 	  && __ul <= numeric_limits<unsigned short>::max())	__v = static_cast<unsigned short>(__ul);      else 	__err |= ios_base::failbit;      return __beg;    }  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, unsigned int& __v) const    {      string __xtrc;      int __base;      __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);      unsigned long __ul;      __convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);      if (!(__err & ios_base::failbit) 	  && __ul <= numeric_limits<unsigned int>::max())	__v = static_cast<unsigned int>(__ul);      else 	__err |= ios_base::failbit;      return __beg;    }  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, unsigned long& __v) const    {      string __xtrc;      int __base;      __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);      return __beg;    }#ifdef _GLIBCPP_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    {      string __xtrc;      int __base;      __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);      return __beg;    }  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, unsigned long long& __v) const    {      string __xtrc;      int __base;      __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);      return __beg;    }#endif  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, float& __v) const    {      string __xtrc;      __xtrc.reserve(32);      __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale);      return __beg;    }  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, double& __v) const    {      string __xtrc;      __xtrc.reserve(32);      __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale);      return __beg;    }  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 double& __v) const    {      string __xtrc;      __xtrc.reserve(32);      __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale);      return __beg;    }  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, void*& __v) const    {      // Prepare for hex formatted input      typedef ios_base::fmtflags        fmtflags;      fmtflags __fmt = __io.flags();      fmtflags __fmtmask = ~(ios_base::showpos | ios_base::basefield                             | ios_base::uppercase | ios_base::internal);      __io.flags(__fmt & __fmtmask | (ios_base::hex | ios_base::showbase));      string __xtrc;      int __base;      __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);      // Reset from hex formatted input      __io.flags(__fmt);      unsigned long __ul;      __convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);      if (!(__err & ios_base::failbit))	__v = reinterpret_cast<void*>(__ul);      else 	__err |= ios_base::failbit;      return __beg;    }  // 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);    }  // Forwarding functions to peel signed from unsigned integer types.  template<typename _CharT>    inline int    __int_to_char(_CharT* __out, const int __size, long __v,		       const _CharT* __lit, ios_base::fmtflags __flags)    {      unsigned long __ul = static_cast<unsigned long>(__v);      bool __neg = false;      if (__v < 0) 	{	  __ul = -__ul;	  __neg = true;	}      return __int_to_char(__out, __size, __ul, __lit, __flags, __neg);     }  template<typename _CharT>    inline int    __int_to_char(_CharT* __out, const int __size, unsigned long __v,		       const _CharT* __lit, ios_base::fmtflags __flags)    { return __int_to_char(__out, __size, __v, __lit, __flags, false); }#ifdef _GLIBCPP_USE_LONG_LONG  template<typename _CharT>    inline int    __int_to_char(_CharT* __out, const int __size, 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(__out, __size, __ull, __lit, __flags, __neg);     }  template<typename _CharT>    inline int    __int_to_char(_CharT* __out, const int __size, unsigned long long __v,		       const _CharT* __lit, ios_base::fmtflags __flags)    { return __int_to_char(__out, __size, __v, __lit, __flags, false); }#endif        template<typename _CharT, typename _ValueT>    int    __int_to_char(_CharT* __out, const int __size, _ValueT __v,		  const _CharT* __lit, ios_base::fmtflags __flags, bool __neg)    {      // Don't write base if already 0.      const bool __showbase = (__flags & ios_base::showbase) && __v;      const ios_base::fmtflags __basefield = __flags & ios_base::basefield;      _CharT* __buf = __out + __size - 1;      _CharT* __bufend = __out + __size;      if (__builtin_expect(__basefield != ios_base::oct &&			   __basefield != ios_base::hex, true))	{	  // Decimal.	  do 	    {	      *__buf-- = __lit[(__v % 10) + __num_base::_S_digits];	      __v /= 10;	    } 	  while (__v != 0);	  if (__neg)	    *__buf-- = __lit[__num_base::_S_minus];	  else if (__flags & ios_base::showpos)	    *__buf-- = __lit[__num_base::_S_plus];	}      else if (__basefield == ios_base::oct)	{	  // Octal.	  do 	    {	      *__buf-- = __lit[(__v & 0x7) + __num_base::_S_digits];	      __v >>= 3;	    } 	  while (__v != 0);	  if (__showbase)	    *__buf-- = __lit[__num_base::_S_digits];	}      else	{	  // Hex.	  const bool __uppercase = __flags & ios_base::uppercase;	  int __case_offset = __uppercase	                      ? __num_base::_S_udigits : __num_base::_S_digits;	  do 	    {	      *__buf-- = __lit[(__v & 0xf) + __case_offset];	      __v >>= 4;	    } 	  while (__v != 0);	  if (__showbase)	    {	      // 'x' or 'X'	      *__buf-- = __lit[__num_base::_S_x + __uppercase];	      // '0'	      *__buf-- = __lit[__num_base::_S_digits];	    }	}      int __ret = __bufend - __buf - 1;      return __ret;    }  template<typename _CharT, typename _OutIter>    void    num_put<_CharT, _OutIter>::    _M_group_int(const string& __grouping, _CharT __sep, ios_base& __io, 		 _CharT* __new, _CharT* __cs, int& __len) const    {      // By itself __add_grouping cannot deal correctly with __ws when      // ios::showbase is set and ios_base::oct || ios_base::hex.      // Therefore we take care "by hand" of the initial 0, 0x or 0X.      // However, remember that the latter do not occur if the number      // printed is '0' (__len == 1).      streamsize __off = 0;      const ios_base::fmtflags __basefield = __io.flags() 	                                     & ios_base::basefield;      if ((__io.flags() & ios_base::showbase) && __len > 1)	if (__basefield == ios_base::oct)	  {	    __off = 1;	    *__new = *__cs;	  }	else if (__basefield == ios_base::hex)	  {	    __off = 2;	    *__new = *__cs;	    *(__new + 1) = *(__cs + 1);	  }      _CharT* __p;      __p = __add_grouping(__new + __off, __sep, 			   __grouping.c_str(),			   __grouping.c_str() + __grouping.size(),			   __cs + __off, __cs + __len);      __len = __p - __new;    }  template<typename _CharT, typename _OutIter>    template<typename _ValueT>      _OutIter      num_put<_CharT, _OutIter>::      _M_convert_int(_OutIter __s, ios_base& __io, _CharT __fill, 		     _ValueT __v) const      {	typedef numpunct<_CharT>  __facet_type;	typedef __locale_cache<numpunct<_CharT> > __cache_type; 	const locale& __loc = __io._M_getloc();	const __cache_type& __lc = __use_cache<__facet_type>(__loc);	const _CharT* __lit = __lc._M_atoms_out;	// Long enough to hold hex, dec, and octal representations.	int __ilen = 4 * sizeof(_ValueT);	_CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) 							     * __ilen));	// [22.2.2.2.2] Stage 1, numeric conversion to character.	// Result is returned right-justified in the buffer.	int __len;	__len = __int_to_char(&__cs[0], __ilen, __v, __lit, __io.flags());	__cs = __cs + __ilen - __len;		// Add grouping, if necessary. 	_CharT* __cs2;	if (__lc._M_use_grouping)	  {	    // Grouping can add (almost) as many separators as the	    // number of digits, but no more.	    __cs2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) 							  * __len * 2));	    _M_group_int(__lc._M_grouping, __lc._M_thousands_sep, __io, 			 __cs2, __cs, __len);	    __cs = __cs2;	  }		// Pad.	_CharT* __cs3;	streamsize __w = __io.width();	if (__w > static_cast<streamsize>(__len))	  {	    __cs3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) 							  * __w));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -