home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / stlport / stl / _num_put.h < prev    next >
C/C++ Source or Header  |  2001-08-28  |  6KB  |  187 lines

  1. /*
  2.  * Copyright (c) 1999
  3.  * Silicon Graphics Computer Systems, Inc.
  4.  *
  5.  * Copyright (c) 1999 
  6.  * Boris Fomitchev
  7.  *
  8.  * This material is provided "as is", with absolutely no warranty expressed
  9.  * or implied. Any use is at your own risk.
  10.  *
  11.  * Permission to use or copy this software for any purpose is hereby granted 
  12.  * without fee, provided the above notices are retained on all copies.
  13.  * Permission to modify the code and to distribute modified code is granted,
  14.  * provided the above notices are retained, and a notice that the code was
  15.  * modified is included with the above copyright notice.
  16.  *
  17.  */ 
  18. // WARNING: This is an internal header file, included by other C++
  19. // standard library headers.  You should not attempt to use this header
  20. // file directly.
  21.  
  22.  
  23. #ifndef _STLP_INTERNAL_NUM_PUT_H
  24. #define _STLP_INTERNAL_NUM_PUT_H
  25.  
  26. #ifndef _STLP_INTERNAL_NUMPUNCT_H
  27. # include <stl/_numpunct.h>
  28. #endif
  29. #ifndef _STLP_INTERNAL_CTYPE_H
  30. # include <stl/_ctype.h>
  31. #endif
  32. #ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
  33. # include <stl/_ostreambuf_iterator.h>
  34. #endif
  35.  
  36. _STLP_BEGIN_NAMESPACE
  37.  
  38. //----------------------------------------------------------------------
  39. // num_put facet
  40.  
  41. # ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
  42. template <class _CharT, class _OutputIter>  
  43. # else
  44. template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >  
  45. # endif
  46. class num_put: public locale::facet
  47. {
  48.   friend class _Locale;
  49. public:
  50.   typedef _CharT      char_type;
  51.   typedef _OutputIter iter_type;
  52.  
  53.   explicit num_put(size_t __refs = 0) : _BaseFacet(__refs) {}
  54.  
  55. # ifndef _STLP_NO_BOOL
  56.   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
  57.                 bool __val) const {
  58.     return do_put(__s, __f, __fill, __val);
  59.   }
  60. # endif
  61.   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
  62.                long __val) const {
  63.     return do_put(__s, __f, __fill, __val);
  64.   }
  65.  
  66.   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
  67.                 unsigned long __val) const {
  68.     return do_put(__s, __f, __fill, __val);
  69.   }
  70.  
  71. #ifdef _STLP_LONG_LONG
  72.   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
  73.                 _STLP_LONG_LONG __val) const {
  74.     return do_put(__s, __f, __fill, __val);
  75.   }
  76.  
  77.   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
  78.                 unsigned _STLP_LONG_LONG __val) const {
  79.     return do_put(__s, __f, __fill, __val);
  80.   }
  81. #endif
  82.  
  83.   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
  84.                 double __val) const {
  85.     return do_put(__s, __f, __fill, (double)__val);
  86.   }
  87.  
  88. #ifndef _STLP_NO_LONG_DOUBLE
  89.   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
  90.                 long double __val) const {
  91.     return do_put(__s, __f, __fill, __val);
  92.   }
  93. # endif
  94.  
  95.   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
  96.                 const void * __val) const {
  97.     return do_put(__s, __f, __fill, __val);
  98.   }
  99.  
  100.   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
  101.  
  102. protected:
  103.   ~num_put() {}   
  104. # ifndef _STLP_NO_BOOL
  105.   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
  106. # endif
  107.   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long __val) const;
  108.   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, unsigned long __val) const;
  109.   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, double __val) const;
  110. #ifndef _STLP_NO_LONG_DOUBLE
  111.   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long double __val) const;
  112. #endif
  113.  
  114. #ifdef _STLP_LONG_LONG
  115.   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, _STLP_LONG_LONG __val) const;
  116.   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, 
  117.                            unsigned _STLP_LONG_LONG __val) const ;
  118. #endif /* _STLP_LONG_LONG  */
  119.   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const;
  120. };
  121.  
  122. # ifdef _STLP_USE_TEMPLATE_EXPORT
  123. _STLP_EXPORT_TEMPLATE_CLASS num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
  124. // _STLP_EXPORT_TEMPLATE_CLASS num_put<char, char*>;
  125. #  ifndef _STLP_NO_WCHAR_T
  126. _STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
  127. // _STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, wchar_t*>;
  128. #  endif /* _STLP_NO_WCHAR_T */
  129. # endif
  130.  
  131. # if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
  132.  
  133. template <class _Integer>
  134. char* _STLP_CALL
  135. __write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
  136.  
  137. void  _STLP_CALL __string_to_float(const string&, float&);
  138. void  _STLP_CALL __string_to_float(const string&, double&);
  139. extern char* _STLP_CALL __write_float(char*, ios_base::fmtflags, int, double);
  140. # ifndef _STLP_NO_LONG_DOUBLE
  141. void  _STLP_CALL __string_to_float(const string&, long double&);
  142. extern char* _STLP_CALL __write_float(char*, ios_base::fmtflags, int, long double);
  143. # endif
  144.  
  145. #ifndef _STLP_NO_WCHAR_T
  146. extern wchar_t* _STLP_CALL __convert_float_buffer(const char*, const char*, wchar_t*, const ctype<wchar_t>&, wchar_t);
  147. #endif
  148. extern void _STLP_CALL __adjust_float_buffer(char*, char*, char);
  149.  
  150. extern char* _STLP_CALL
  151. __write_integer(char* buf, ios_base::fmtflags flags, long x);
  152.  
  153. extern ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int);
  154. #  ifndef _STLP_NO_WCHAR_T
  155. extern ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int);
  156. #  endif
  157.  
  158. # endif
  159.  
  160. # if defined (__BORLANDC__) && defined (_RTLDLL)
  161. inline void _Stl_loc_init_num_put() {
  162.   
  163.   num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 14;
  164.   num_put<char, char*>::id._M_index = 15;
  165.   
  166. # ifndef _STLP_NO_WCHAR_T
  167.   num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > ::id._M_index = 33;
  168.   num_put<wchar_t, wchar_t*>::id._M_index = 34;
  169. # endif
  170.   
  171. }
  172.  
  173. # endif
  174.  
  175. _STLP_END_NAMESPACE
  176.  
  177. #  if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && ! defined (_STLP_LINK_TIME_INSTANTIATION)
  178. #   include <stl/_num_put.c>
  179. #  endif
  180.  
  181. #endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */
  182.  
  183. // Local Variables:
  184. // mode:C++
  185. // End:
  186.  
  187.