/home/ntakagi/work/STLport-5.1.5/stlport/stl/_num_put.cGo to the documentation of this file.00001 /* 00002 * Copyright (c) 1999 00003 * Silicon Graphics Computer Systems, Inc. 00004 * 00005 * Copyright (c) 1999 00006 * Boris Fomitchev 00007 * 00008 * This material is provided "as is", with absolutely no warranty expressed 00009 * or implied. Any use is at your own risk. 00010 * 00011 * Permission to use or copy this software for any purpose is hereby granted 00012 * without fee, provided the above notices are retained on all copies. 00013 * Permission to modify the code and to distribute modified code is granted, 00014 * provided the above notices are retained, and a notice that the code was 00015 * modified is included with the above copyright notice. 00016 * 00017 */ 00018 #ifndef _STLP_NUM_PUT_C 00019 #define _STLP_NUM_PUT_C 00020 00021 #ifndef _STLP_INTERNAL_NUM_PUT_H 00022 # include <stl/_num_put.h> 00023 #endif 00024 00025 #ifndef _STLP_INTERNAL_LIMITS 00026 # include <stl/_limits.h> 00027 #endif 00028 00029 _STLP_BEGIN_NAMESPACE 00030 00031 _STLP_MOVE_TO_PRIV_NAMESPACE 00032 00033 // __do_put_float and its helper functions. Strategy: write the output 00034 // to a buffer of char, transform the buffer to _CharT, and then copy 00035 // it to the output. 00036 00037 //---------------------------------------------------------------------- 00038 // num_put facet 00039 00040 template <class _CharT, class _OutputIter> 00041 _OutputIter _STLP_CALL 00042 __copy_float_and_fill(const _CharT* __first, const _CharT* __last, 00043 _OutputIter __oi, 00044 ios_base::fmtflags __flags, 00045 streamsize __width, _CharT __fill, 00046 _CharT __xplus, _CharT __xminus) { 00047 if (__width <= __last - __first) 00048 return copy(__first, __last, __oi); 00049 else { 00050 streamsize __pad = __width - (__last - __first); 00051 ios_base::fmtflags __dir = __flags & ios_base::adjustfield; 00052 00053 if (__dir == ios_base::left) { 00054 __oi = copy(__first, __last, __oi); 00055 return __fill_n(__oi, __pad, __fill); 00056 } 00057 else if (__dir == ios_base::internal && __first != __last && 00058 (*__first == __xplus || *__first == __xminus)) { 00059 *__oi++ = *__first++; 00060 __oi = __fill_n(__oi, __pad, __fill); 00061 return copy(__first, __last, __oi); 00062 } 00063 else { 00064 __oi = __fill_n(__oi, __pad, __fill); 00065 return copy(__first, __last, __oi); 00066 } 00067 } 00068 } 00069 00070 #if !defined (_STLP_NO_WCHAR_T) 00071 // Helper routine for wchar_t 00072 template <class _OutputIter> 00073 _OutputIter _STLP_CALL 00074 __put_float(__iostring &__str, _OutputIter __oi, 00075 ios_base& __f, wchar_t __fill, 00076 wchar_t __decimal_point, wchar_t __sep, 00077 size_t __group_pos, const string& __grouping) { 00078 const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet()); 00079 00080 __iowstring __wbuf; 00081 __convert_float_buffer(__str, __wbuf, __ct, __decimal_point); 00082 00083 if (!__grouping.empty()) { 00084 __insert_grouping(__wbuf, __group_pos, __grouping, 00085 __sep, __ct.widen('+'), __ct.widen('-'), 0); 00086 } 00087 00088 return __copy_float_and_fill(__CONST_CAST(wchar_t*, __wbuf.data()), 00089 __CONST_CAST(wchar_t*, __wbuf.data()) + __wbuf.size(), __oi, 00090 __f.flags(), __f.width(0), __fill, __ct.widen('+'), __ct.widen('-')); 00091 } 00092 #endif /* WCHAR_T */ 00093 00094 // Helper routine for char 00095 template <class _OutputIter> 00096 _OutputIter _STLP_CALL 00097 __put_float(__iostring &__str, _OutputIter __oi, 00098 ios_base& __f, char __fill, 00099 char __decimal_point, char __sep, 00100 size_t __group_pos, const string& __grouping) { 00101 if ((__group_pos < __str.size()) && (__str[__group_pos] == '.')) { 00102 __str[__group_pos] = __decimal_point; 00103 } 00104 00105 if (!__grouping.empty()) { 00106 __insert_grouping(__str, __group_pos, 00107 __grouping, __sep, '+', '-', 0); 00108 } 00109 00110 return __copy_float_and_fill(__CONST_CAST(char*, __str.data()), 00111 __CONST_CAST(char*, __str.data()) + __str.size(), __oi, 00112 __f.flags(), __f.width(0), __fill, '+', '-'); 00113 } 00114 00115 template <class _CharT, class _OutputIter, class _Float> 00116 _OutputIter _STLP_CALL 00117 __do_put_float(_OutputIter __s, ios_base& __f, 00118 _CharT __fill, _Float __x) { 00119 __iostring __buf; 00120 00121 size_t __group_pos = __write_float(__buf, __f.flags(), (int)__f.precision(), __x); 00122 00123 const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet()); 00124 00125 return __put_float(__buf, __s, __f, __fill, 00126 __np.decimal_point(), __np.thousands_sep(), 00127 __group_pos, __f._M_grouping()); 00128 } 00129 00130 inline void __get_money_digits_aux (__iostring &__buf, ios_base &, _STLP_LONGEST_FLOAT_TYPE __x) 00131 { __get_floor_digits(__buf, __x); } 00132 00133 #if !defined (_STLP_NO_WCHAR_T) 00134 inline void __get_money_digits_aux (__iowstring &__wbuf, ios_base &__f, _STLP_LONGEST_FLOAT_TYPE __x) { 00135 __iostring __buf; 00136 __get_floor_digits(__buf, __x); 00137 00138 const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet()); 00139 __convert_float_buffer(__buf, __wbuf, __ct, wchar_t(0), false); 00140 } 00141 #endif 00142 00143 template <class _CharT> 00144 void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT) &__buf, ios_base& __f, _STLP_LONGEST_FLOAT_TYPE __x) 00145 { __get_money_digits_aux(__buf, __f, __x); } 00146 00147 // _M_do_put_integer and its helper functions. 00148 00149 template <class _CharT, class _OutputIter> 00150 _OutputIter _STLP_CALL 00151 __copy_integer_and_fill(const _CharT* __buf, ptrdiff_t __len, 00152 _OutputIter __oi, 00153 ios_base::fmtflags __flg, streamsize __wid, _CharT __fill, 00154 _CharT __xplus, _CharT __xminus) { 00155 if (__len >= __wid) 00156 return copy(__buf, __buf + __len, __oi); 00157 else { 00158 //casting numeric_limits<ptrdiff_t>::max to streamsize only works is ptrdiff_t is signed or streamsize representation 00159 //is larger than ptrdiff_t one. 00160 _STLP_STATIC_ASSERT((sizeof(streamsize) > sizeof(ptrdiff_t)) || 00161 (sizeof(streamsize) == sizeof(ptrdiff_t)) && numeric_limits<ptrdiff_t>::is_signed) 00162 ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()), 00163 __STATIC_CAST(streamsize, __wid - __len))); 00164 ios_base::fmtflags __dir = __flg & ios_base::adjustfield; 00165 00166 if (__dir == ios_base::left) { 00167 __oi = copy(__buf, __buf + __len, __oi); 00168 return __fill_n(__oi, __pad, __fill); 00169 } 00170 else if (__dir == ios_base::internal && __len != 0 && 00171 (__buf[0] == __xplus || __buf[0] == __xminus)) { 00172 *__oi++ = __buf[0]; 00173 __oi = __fill_n(__oi, __pad, __fill); 00174 return copy(__buf + 1, __buf + __len, __oi); 00175 } 00176 else if (__dir == ios_base::internal && __len >= 2 && 00177 (__flg & ios_base::showbase) && 00178 (__flg & ios_base::basefield) == ios_base::hex) { 00179 *__oi++ = __buf[0]; 00180 *__oi++ = __buf[1]; 00181 __oi = __fill_n(__oi, __pad, __fill); 00182 return copy(__buf + 2, __buf + __len, __oi); 00183 } 00184 else { 00185 __oi = __fill_n(__oi, __pad, __fill); 00186 return copy(__buf, __buf + __len, __oi); 00187 } 00188 } 00189 } 00190 00191 #if !defined (_STLP_NO_WCHAR_T) 00192 // Helper function for wchar_t 00193 template <class _OutputIter> 00194 _OutputIter _STLP_CALL 00195 __put_integer(char* __buf, char* __iend, _OutputIter __s, 00196 ios_base& __f, 00197 ios_base::fmtflags __flags, wchar_t __fill) { 00198 locale __loc = __f.getloc(); 00199 // const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__loc); 00200 const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet()); 00201 00202 wchar_t __xplus = __ct.widen('+'); 00203 wchar_t __xminus = __ct.widen('-'); 00204 00205 wchar_t __wbuf[64]; 00206 __ct.widen(__buf, __iend, __wbuf); 00207 ptrdiff_t __len = __iend - __buf; 00208 wchar_t* __eend = __wbuf + __len; 00209 00210 // const numpunct<wchar_t>& __np = use_facet<numpunct<wchar_t> >(__loc); 00211 // const string& __grouping = __np.grouping(); 00212 00213 const numpunct<wchar_t>& __np = *__STATIC_CAST(const numpunct<wchar_t>*, __f._M_numpunct_facet()); 00214 const string& __grouping = __f._M_grouping(); 00215 00216 if (!__grouping.empty()) { 00217 int __basechars; 00218 if (__flags & ios_base::showbase) 00219 switch (__flags & ios_base::basefield) { 00220 case ios_base::hex: __basechars = 2; break; 00221 case ios_base::oct: __basechars = 1; break; 00222 default: __basechars = 0; 00223 } 00224 else 00225 __basechars = 0; 00226 00227 __len = __insert_grouping(__wbuf, __eend, __grouping, __np.thousands_sep(), 00228 __xplus, __xminus, __basechars); 00229 } 00230 00231 return __copy_integer_and_fill((wchar_t*)__wbuf, __len, __s, 00232 __flags, __f.width(0), __fill, __xplus, __xminus); 00233 } 00234 #endif 00235 00236 // Helper function for char 00237 template <class _OutputIter> 00238 _OutputIter _STLP_CALL 00239 __put_integer(char* __buf, char* __iend, _OutputIter __s, 00240 ios_base& __f, ios_base::fmtflags __flags, char __fill) { 00241 char __grpbuf[64]; 00242 ptrdiff_t __len = __iend - __buf; 00243 00244 // const numpunct<char>& __np = use_facet<numpunct<char> >(__f.getloc()); 00245 // const string& __grouping = __np.grouping(); 00246 00247 const numpunct<char>& __np = *__STATIC_CAST(const numpunct<char>*, __f._M_numpunct_facet()); 00248 const string& __grouping = __f._M_grouping(); 00249 00250 if (!__grouping.empty()) { 00251 int __basechars; 00252 if (__flags & ios_base::showbase) 00253 switch (__flags & ios_base::basefield) { 00254 case ios_base::hex: __basechars = 2; break; 00255 case ios_base::oct: __basechars = 1; break; 00256 default: __basechars = 0; 00257 } 00258 else 00259 __basechars = 0; 00260 00261 // make sure there is room at the end of the buffer 00262 // we pass to __insert_grouping 00263 copy(__buf, __iend, (char *) __grpbuf); 00264 __buf = __grpbuf; 00265 __iend = __grpbuf + __len; 00266 __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(), 00267 '+', '-', __basechars); 00268 } 00269 00270 return __copy_integer_and_fill(__buf, __len, __s, __flags, __f.width(0), __fill, '+', '-'); 00271 } 00272 00273 #if defined (_STLP_LONG_LONG) 00274 typedef _STLP_LONG_LONG __max_int_t; 00275 typedef unsigned _STLP_LONG_LONG __umax_int_t; 00276 #else 00277 typedef long __max_int_t; 00278 typedef unsigned long __umax_int_t; 00279 #endif 00280 00281 _STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo(); 00282 _STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi(); 00283 00284 template <class _Integer> 00285 inline char* _STLP_CALL 00286 __write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __true_type& /* is_signed */) { 00287 const bool __negative = __x < 0 ; 00288 __max_int_t __temp = __x; 00289 __umax_int_t __utemp = __negative?-__temp:__temp; 00290 00291 for (; __utemp != 0; __utemp /= 10) 00292 *--__ptr = (char)((int)(__utemp % 10) + '0'); 00293 // put sign if needed or requested 00294 if (__negative) 00295 *--__ptr = '-'; 00296 else if (__flags & ios_base::showpos) 00297 *--__ptr = '+'; 00298 return __ptr; 00299 } 00300 00301 template <class _Integer> 00302 inline char* _STLP_CALL 00303 __write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __false_type& /* is_signed */) { 00304 for (; __x != 0; __x /= 10) 00305 *--__ptr = (char)((int)(__x % 10) + '0'); 00306 // put sign if requested 00307 if (__flags & ios_base::showpos) 00308 *--__ptr = '+'; 00309 return __ptr; 00310 } 00311 00312 template <class _Integer> 00313 char* _STLP_CALL 00314 __write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x) { 00315 char* __ptr = __buf; 00316 00317 if (__x == 0) { 00318 *--__ptr = '0'; 00319 if ((__flags & ios_base::showpos) && ((__flags & (ios_base::oct | ios_base::hex)) == 0)) 00320 *--__ptr = '+'; 00321 // oct or hex base shall not be added to the 0 value (see '#' flag in C formating strings) 00322 } 00323 else { 00324 switch (__flags & ios_base::basefield) { 00325 case ios_base::oct: 00326 { 00327 __umax_int_t __temp = __x; 00328 // if the size of integer is less than 8, clear upper part 00329 if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 ) 00330 __temp &= 0xFFFFFFFF; 00331 00332 for (; __temp != 0; __temp >>=3) 00333 *--__ptr = (char)((((unsigned)__temp)& 0x7) + '0'); 00334 00335 // put leading '0' if showbase is set 00336 if (__flags & ios_base::showbase) 00337 *--__ptr = '0'; 00338 } 00339 break; 00340 case ios_base::hex: 00341 { 00342 const char* __table_ptr = (__flags & ios_base::uppercase) ? 00343 __hex_char_table_hi() : __hex_char_table_lo(); 00344 __umax_int_t __temp = __x; 00345 // if the size of integer is less than 8, clear upper part 00346 if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 ) 00347 __temp &= 0xFFFFFFFF; 00348 00349 for (; __temp != 0; __temp >>=4) 00350 *--__ptr = __table_ptr[((unsigned)__temp & 0xF)]; 00351 00352 if (__flags & ios_base::showbase) { 00353 *--__ptr = __table_ptr[16]; 00354 *--__ptr = '0'; 00355 } 00356 } 00357 break; 00358 //case ios_base::dec: 00359 default: 00360 { 00361 #if defined(__HP_aCC) && (__HP_aCC == 1) 00362 bool _IsSigned = !((_Integer)-1 > 0); 00363 if (_IsSigned) 00364 __ptr = __write_decimal_backward(__ptr, __x, __flags, __true_type() ); 00365 else 00366 __ptr = __write_decimal_backward(__ptr, __x, __flags, __false_type() ); 00367 #else 00368 typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned; 00369 __ptr = __write_decimal_backward(__ptr, __x, __flags, _IsSigned()); 00370 #endif 00371 } 00372 break; 00373 } 00374 } 00375 00376 // return pointer to beginning of the string 00377 return __ptr; 00378 } 00379 00380 template <class _CharT, class _OutputIter, class _Integer> 00381 _OutputIter _STLP_CALL 00382 __do_put_integer(_OutputIter __s, ios_base& __f, _CharT __fill, _Integer __x) { 00383 // buffer size = number of bytes * number of digit necessary in the smallest Standard base (base 8, 3 digits/byte) 00384 // plus the longest base representation '0x' 00385 // Do not use __buf_size to define __buf static buffer, some compilers (HP aCC) do not accept const variable as 00386 // the specification of a static buffer size. 00387 char __buf[sizeof(_Integer) * 3 + 2]; 00388 const ptrdiff_t __buf_size = sizeof(__buf) / sizeof(char); 00389 ios_base::fmtflags __flags = __f.flags(); 00390 char* __ibeg = __write_integer_backward((char*)__buf+__buf_size, __flags, __x); 00391 return __put_integer(__ibeg, (char*)__buf+__buf_size, __s, __f, __flags, __fill); 00392 } 00393 00394 _STLP_MOVE_TO_STD_NAMESPACE 00395 00396 // 00397 // num_put<> 00398 // 00399 00400 #if (_STLP_STATIC_TEMPLATE_DATA > 0) 00401 00402 # if !defined (__BORLANDC__) 00403 template <class _CharT, class _OutputIterator> 00404 locale::id num_put<_CharT, _OutputIterator>::id; 00405 # endif 00406 00407 # if (defined (__CYGWIN__) || defined (__MINGW32__)) && \ 00408 defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT) 00409 /* 00410 * Under cygwin, when STLport is used as a shared library, the id needs 00411 * to be specified as imported otherwise they will be duplicated in the 00412 * calling executable. 00413 */ 00414 template <> 00415 _STLP_DECLSPEC locale::id num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id; 00416 /* 00417 template <> 00418 _STLP_DECLSPEC locale::id num_put<char, char*>::id; 00419 */ 00420 00421 # if !defined (_STLP_NO_WCHAR_T) 00422 template <> 00423 _STLP_DECLSPEC locale::id num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; 00424 /* 00425 template <> 00426 _STLP_DECLSPEC locale::id num_put<wchar_t, wchar_t*>::id; 00427 */ 00428 # endif 00429 00430 # endif /* __CYGWIN__ && _STLP_USE_DYNAMIC_LIB */ 00431 00432 #else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ 00433 00434 //typedef num_put<char, char*> num_put_char; 00435 typedef num_put<char, ostreambuf_iterator<char, char_traits<char> > > num_put_char_2; 00436 00437 //__DECLARE_INSTANCE(locale::id, num_put_char::id, ); 00438 __DECLARE_INSTANCE(locale::id, num_put_char_2::id, ); 00439 00440 # if !defined (_STLP_NO_WCHAR_T) 00441 00442 //typedef num_put<wchar_t, wchar_t*> num_put_wchar_t; 00443 typedef num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > num_put_wchar_t_2; 00444 00445 //__DECLARE_INSTANCE(locale::id, num_put_wchar_t::id, ); 00446 __DECLARE_INSTANCE(locale::id, num_put_wchar_t_2::id, ); 00447 00448 # endif 00449 00450 #endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ 00451 00452 // issue 118 00453 00454 #if !defined (_STLP_NO_BOOL) 00455 template <class _CharT, class _OutputIter> 00456 _OutputIter 00457 num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, 00458 char_type __fill, bool __val) const { 00459 if (!(__f.flags() & ios_base::boolalpha)) 00460 return this->do_put(__s, __f, __fill, __STATIC_CAST(long,__val)); 00461 00462 locale __loc = __f.getloc(); 00463 // typedef numpunct<_CharT> _Punct; 00464 // const _Punct& __np = use_facet<_Punct>(__loc); 00465 00466 const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet()); 00467 00468 basic_string<_CharT> __str = __val ? __np.truename() : __np.falsename(); 00469 00470 // Reuse __copy_integer_and_fill. Since internal padding makes no 00471 // sense for bool, though, make sure we use something else instead. 00472 // The last two argument to __copy_integer_and_fill are dummies. 00473 ios_base::fmtflags __flags = __f.flags(); 00474 if ((__flags & ios_base::adjustfield) == ios_base::internal) 00475 __flags = (__flags & ~ios_base::adjustfield) | ios_base::right; 00476 00477 return _STLP_PRIV __copy_integer_and_fill(__str.c_str(), __str.size(), __s, 00478 __flags, __f.width(0), __fill, 00479 (_CharT) 0, (_CharT) 0); 00480 } 00481 00482 #endif 00483 00484 template <class _CharT, class _OutputIter> 00485 _OutputIter 00486 num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, 00487 long __val) const 00488 { return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } 00489 00490 template <class _CharT, class _OutputIter> 00491 _OutputIter 00492 num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, 00493 unsigned long __val) const 00494 { return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } 00495 00496 template <class _CharT, class _OutputIter> 00497 _OutputIter 00498 num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, 00499 double __val) const 00500 { return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); } 00501 00502 #if !defined (_STLP_NO_LONG_DOUBLE) 00503 template <class _CharT, class _OutputIter> 00504 _OutputIter 00505 num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, 00506 long double __val) const 00507 { return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); } 00508 #endif 00509 00510 #if defined (_STLP_LONG_LONG) 00511 template <class _CharT, class _OutputIter> 00512 _OutputIter 00513 num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, 00514 _STLP_LONG_LONG __val) const 00515 { return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } 00516 00517 template <class _CharT, class _OutputIter> 00518 _OutputIter 00519 num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, 00520 unsigned _STLP_LONG_LONG __val) const 00521 { return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } 00522 #endif /* _STLP_LONG_LONG */ 00523 00524 00525 // lib.facet.num.put.virtuals "12 For conversion from void* the specifier is %p." 00526 template <class _CharT, class _OutputIter> 00527 _OutputIter 00528 num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT /*__fill*/, 00529 const void* __val) const { 00530 const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __f._M_ctype_facet()); 00531 ios_base::fmtflags __save_flags = __f.flags(); 00532 00533 __f.setf(ios_base::hex, ios_base::basefield); 00534 __f.setf(ios_base::showbase); 00535 __f.setf(ios_base::internal, ios_base::adjustfield); 00536 __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix 00537 # if defined(_STLP_LONG_LONG) && !defined(__MRC__) //*ty 11/24/2001 - MrCpp can not cast from void* to long long 00538 _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned _STLP_LONG_LONG,__val)); 00539 # else 00540 _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned long,__val)); 00541 # endif 00542 __f.flags(__save_flags); 00543 return result; 00544 } 00545 00546 _STLP_END_NAMESPACE 00547 00548 #endif /* _STLP_NUM_PUT_C */ 00549 00550 // Local Variables: 00551 // mode:C++ 00552 // End:
Generated on Mon Mar 10 15:32:31 2008 by ![]() |