sl@0: /* sl@0: * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. sl@0: * sl@0: * Copyright (c) 1999 sl@0: * Silicon Graphics Computer Systems, Inc. sl@0: * sl@0: * Copyright (c) 1999 sl@0: * Boris Fomitchev sl@0: * sl@0: * This material is provided "as is", with absolutely no warranty expressed sl@0: * or implied. Any use is at your own risk. sl@0: * sl@0: * Permission to use or copy this software for any purpose is hereby granted sl@0: * without fee, provided the above notices are retained on all copies. sl@0: * Permission to modify the code and to distribute modified code is granted, sl@0: * provided the above notices are retained, and a notice that the code was sl@0: * modified is included with the above copyright notice. sl@0: * sl@0: */ sl@0: #include "stlport_prefix.h" sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #ifdef __SYMBIAN32__WSD__ sl@0: #include sl@0: #endif //__SYMBIAN32__WSD__ sl@0: sl@0: _STLP_BEGIN_NAMESPACE sl@0: _STLP_MOVE_TO_PRIV_NAMESPACE sl@0: sl@0: // __valid_grouping compares two strings, one representing the sl@0: // group sizes encountered when reading an integer, and the other sl@0: // representing the valid group sizes as returned by the numpunct sl@0: // grouping() member function. Both are interpreted right-to-left. sl@0: // The grouping string is treated as if it were extended indefinitely sl@0: // with its last value. For a grouping to be valid, each term in sl@0: // the first string must be equal to the corresponding term in the sl@0: // second, except for the last, which must be less than or equal. sl@0: sl@0: // boris : this takes reversed first string ! sl@0: _STLP_DECLSPEC bool _STLP_CALL sl@0: __valid_grouping(const char * first1, const char * last1, sl@0: const char * first2, const char * last2) { sl@0: if (first1 == last1 || first2 == last2) return true; sl@0: sl@0: --last1; --last2; sl@0: sl@0: while (first1 != last1) { sl@0: if (*last1 != *first2) sl@0: return false; sl@0: --last1; sl@0: if (first2 != last2) ++first2; sl@0: } sl@0: sl@0: return *last1 <= *first2; sl@0: } sl@0: sl@0: _STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned __index) { sl@0: static const unsigned char __val_table[128] = { sl@0: 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, sl@0: 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, sl@0: 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, sl@0: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, sl@0: 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, sl@0: 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, sl@0: 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, sl@0: 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF sl@0: }; sl@0: sl@0: return __val_table[__index]; sl@0: } sl@0: sl@0: _STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms() sl@0: { return "+-0xX"; } sl@0: sl@0: // index is actually a char sl@0: sl@0: #if !defined (_STLP_NO_WCHAR_T) sl@0: sl@0: // Similar, except return the character itself instead of the numeric sl@0: // value. Used for floating-point input. sl@0: _STLP_DECLSPEC bool _STLP_CALL __get_fdigit(wchar_t& c, const wchar_t* digits) { sl@0: const wchar_t* p = find(digits, digits + 10, c); sl@0: if (p != digits + 10) { sl@0: c = (char)('0' + (p - digits)); sl@0: return true; sl@0: } sl@0: else sl@0: return false; sl@0: } sl@0: sl@0: _STLP_DECLSPEC bool _STLP_CALL __get_fdigit_or_sep(wchar_t& c, wchar_t sep, sl@0: const wchar_t * digits) { sl@0: if (c == sep) { sl@0: c = (char)','; sl@0: return true; sl@0: } sl@0: else sl@0: return __get_fdigit(c, digits); sl@0: } sl@0: sl@0: #endif sl@0: sl@0: _STLP_MOVE_TO_STD_NAMESPACE sl@0: sl@0: #if defined (__SYMBIAN32__WSD__) sl@0: template <> sl@0: _STLP_DECLSPEC locale::id& num_get > >::GetFacetLocaleId() sl@0: { sl@0: return get_libcpp_wsd().num_get_char_istreambuf_iterator_id; sl@0: } sl@0: # ifndef _STLP_NO_WCHAR_T sl@0: template <> sl@0: _STLP_DECLSPEC locale::id& num_get > >::GetFacetLocaleId() sl@0: { sl@0: return get_libcpp_wsd().num_get_wchar_istreambuf_iterator_id; sl@0: } sl@0: # endif /* _STLP_NO_WCHAR_T */ sl@0: #endif /* __SYMBIAN32__WSD__ */ sl@0: sl@0: #if !defined(_STLP_NO_FORCE_INSTANTIATE) sl@0: //---------------------------------------------------------------------- sl@0: // Force instantiation of of num_get<> sl@0: template class _STLP_CLASS_DECLSPEC istreambuf_iterator >; sl@0: // template class num_get; sl@0: template class num_get > >; sl@0: sl@0: # if !defined (_STLP_NO_WCHAR_T) sl@0: template class _STLP_CLASS_DECLSPEC istreambuf_iterator >; sl@0: template class num_get > >; sl@0: // template class num_get; sl@0: # endif sl@0: #endif sl@0: sl@0: #if defined(__EPOC32__) sl@0: template <> sl@0: locale::id num_get > >::id={12}; sl@0: sl@0: # if !defined (STLP_NO_WCHAR_T) sl@0: template <> sl@0: locale::id num_get > >::id={31}; sl@0: # endif sl@0: #endif sl@0: sl@0: _STLP_END_NAMESPACE sl@0: sl@0: // Local Variables: sl@0: // mode:C++ sl@0: // End: