911 const string _Grouping = _Punct_fac.grouping();
914 _NUMGET_SIGNOFF = 22,
917 static const char _Src[] = {
"0123456789ABCDEFabcdef-+XxPp"};
918 _Elem _Atoms[
sizeof (
_Src) - 1];
921 _Ctype_fac.widen(&_Src[0], &_Src[
sizeof (_Src) - 1], _Atoms);
929 else if (*_First == _Atoms[_NUMGET_SIGNOFF + 1])
930 *_Ptr++ =
'+', ++_First;
931 else if (*_First == _Atoms[_NUMGET_SIGNOFF])
932 *_Ptr++ =
'-', ++_First;
937 bool _Seendigit =
false;
938 int _Significant = 0;
941 if (_First ==
_Last || *_First != _Atoms[0])
943 else if (++_First !=
_Last
944 && (*_First == _Atoms[_NUMGET_XOFF + 1]
945 || *_First == _Atoms[_NUMGET_XOFF]))
950 const char *_Pg = &_Grouping[0];
951 if (*_Pg ==
CHAR_MAX || *_Pg <=
'\0')
952 for (; _First !=
_Last
953 && (_Idx =
_Find_elem(_Atoms, *_First)) < _NUMGET_SIGNOFF;
954 _Seendigit =
true, ++_First)
957 else if (_Idx == 0 && _Significant == 0)
961 *_Ptr++ = _Src[_Idx];
966 const _Elem _Kseparator = _Grouping.size() == 0
967 ? (_Elem)0 : _Punct_fac.thousands_sep();
968 string _Groups((
size_t)1,
'\0');
971 for (; _First !=
_Last; ++_First)
972 if ((_Idx =
_Find_elem(_Atoms, *_First)) < _NUMGET_SIGNOFF)
977 else if (_Idx == 0 && _Significant == 0)
981 *_Ptr++ = _Src[_Idx];
987 else if (_Groups[_Group] ==
'\0'
988 || _Kseparator == (_Elem)0
989 || *_First != _Kseparator)
993 _Groups.append((
size_t)1,
'\0');
998 else if (
'\0' < _Groups[_Group])
1003 while (!_Bad && 0 < _Group)
1006 else if ((0 < --_Group && *_Pg != _Groups[_Group])
1007 || (0 == _Group && *_Pg < _Groups[_Group]))
1009 else if (
'\0' < _Pg[1])
1013 if (_Seendigit && _Significant == 0)
1016 if (_First !=
_Last && *_First == _Punct_fac.decimal_point())
1019 if (_Significant == 0)
1021 for (; _First !=
_Last && *_First == _Atoms[0];
1022 _Seendigit =
true, ++_First)
1025 *_Ptr++ =
'0', ++_Phex;
1028 for (; _First !=
_Last
1029 && (_Idx =
_Find_elem(_Atoms, *_First)) < _NUMGET_SIGNOFF;
1030 _Seendigit =
true, ++_First)
1033 *_Ptr++ = _Src[_Idx];
1037 if (_Seendigit && _First !=
_Last
1038 && (*_First == _Atoms[_NUMGET_POFF + 1]
1039 || *_First == _Atoms[_NUMGET_POFF]))
1041 *_Ptr++ =
'p', ++_First;
1042 _Seendigit =
false, _Significant = 0;
1044 if (_First ==
_Last)
1046 else if (*_First == _Atoms[_NUMGET_SIGNOFF + 1])
1047 *_Ptr++ =
'+', ++_First;
1048 else if (*_First == _Atoms[_NUMGET_SIGNOFF])
1049 *_Ptr++ =
'-', ++_First;
1050 for (; _First !=
_Last && *_First == _Atoms[0]; )
1051 _Seendigit =
true, ++_First;
1054 for (; _First !=
_Last
1055 && (_Idx =
_Find_elem(_Atoms, *_First)) < _NUMGET_SIGNOFF;
1056 _Seendigit =
true, ++_First)
1059 *_Ptr++ = _Src[_Idx];
1064 if (_Bad || !_Seendigit)
#define _USE(loc, fac)
Definition: xlocale:555
#define _MAX_SIG_DIG
Definition: yvals.h:584
char * decimal_point
Definition: locale.h:56
_END_C_LIB_DECL _STD_BEGIN size_t _Find_elem(_Elem *_Base, _Elem _Ch)
Definition: xlocnum:54
_Check_return_opt_ _CRTIMP struct lconv *__cdecl localeconv(void)
#define _MAX_EXP_DIG
Definition: yvals.h:582
numpunct< _Elem > _Mypunct
Definition: xlocnum:263
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:422
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
#define CHAR_MAX
Definition: limits.h:29
_FwdIt _Last
Definition: algorithm:1936