_num_put.h

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 // WARNING: This is an internal header file, included by other C++
00019 // standard library headers.  You should not attempt to use this header
00020 // file directly.
00021 
00022 
00023 #ifndef _STLP_INTERNAL_NUM_PUT_H
00024 #define _STLP_INTERNAL_NUM_PUT_H
00025 
00026 #ifndef _STLP_INTERNAL_NUMPUNCT_H
00027 # include <stl/_numpunct.h>
00028 #endif
00029 #ifndef _STLP_INTERNAL_CTYPE_H
00030 # include <stl/_ctype.h>
00031 #endif
00032 #ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
00033 # include <stl/_ostreambuf_iterator.h>
00034 #endif
00035 
00036 _STLP_BEGIN_NAMESPACE
00037 
00038 //----------------------------------------------------------------------
00039 // num_put facet
00040 
00041 # ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
00042 template <class _CharT, class _OutputIter>  
00043 # else
00044 template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >  
00045 # endif
00046 class num_put: public locale::facet
00047 {
00048   friend class _Locale;
00049 public:
00050   typedef _CharT      char_type;
00051   typedef _OutputIter iter_type;
00052 
00053   explicit num_put(size_t __refs = 0) : _BaseFacet(__refs) {}
00054 
00055 # ifndef _STLP_NO_BOOL
00056   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
00057                 bool __val) const {
00058     return do_put(__s, __f, __fill, __val);
00059   }
00060 # endif
00061   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
00062                long __val) const {
00063     return do_put(__s, __f, __fill, __val);
00064   }
00065 
00066   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
00067                 unsigned long __val) const {
00068     return do_put(__s, __f, __fill, __val);
00069   }
00070 
00071 #ifdef _STLP_LONG_LONG
00072   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
00073                 _STLP_LONG_LONG __val) const {
00074     return do_put(__s, __f, __fill, __val);
00075   }
00076 
00077   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
00078                 unsigned _STLP_LONG_LONG __val) const {
00079     return do_put(__s, __f, __fill, __val);
00080   }
00081 #endif
00082 
00083   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
00084                 double __val) const {
00085     return do_put(__s, __f, __fill, (double)__val);
00086   }
00087 
00088 #ifndef _STLP_NO_LONG_DOUBLE
00089   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
00090                 long double __val) const {
00091     return do_put(__s, __f, __fill, __val);
00092   }
00093 # endif
00094 
00095   iter_type put(iter_type __s, ios_base& __f, char_type __fill,
00096                 const void * __val) const {
00097     return do_put(__s, __f, __fill, __val);
00098   }
00099 
00100   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
00101 
00102 protected:
00103   ~num_put() {}   
00104 # ifndef _STLP_NO_BOOL
00105   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
00106 # endif
00107   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long __val) const;
00108   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, unsigned long __val) const;
00109   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, double __val) const;
00110 #ifndef _STLP_NO_LONG_DOUBLE
00111   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long double __val) const;
00112 #endif
00113 
00114 #ifdef _STLP_LONG_LONG
00115   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, _STLP_LONG_LONG __val) const;
00116   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, 
00117                            unsigned _STLP_LONG_LONG __val) const ;
00118 #endif /* _STLP_LONG_LONG  */
00119   virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const;
00120 };
00121 
00122 # ifdef _STLP_USE_TEMPLATE_EXPORT
00123 _STLP_EXPORT_TEMPLATE_CLASS num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
00124 // _STLP_EXPORT_TEMPLATE_CLASS num_put<char, char*>;
00125 #  ifndef _STLP_NO_WCHAR_T
00126 _STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
00127 // _STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, wchar_t*>;
00128 #  endif /* _STLP_NO_WCHAR_T */
00129 # endif
00130 
00131 # if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
00132 
00133 template <class _Integer>
00134 char* _STLP_CALL
00135 __write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
00136 
00137 void  _STLP_CALL __string_to_float(const string&, float&);
00138 void  _STLP_CALL __string_to_float(const string&, double&);
00139 extern char* _STLP_CALL __write_float(char*, ios_base::fmtflags, int, double);
00140 # ifndef _STLP_NO_LONG_DOUBLE
00141 void  _STLP_CALL __string_to_float(const string&, long double&);
00142 extern char* _STLP_CALL __write_float(char*, ios_base::fmtflags, int, long double);
00143 # endif
00144 
00145 #ifndef _STLP_NO_WCHAR_T
00146 extern wchar_t* _STLP_CALL __convert_float_buffer(const char*, const char*, wchar_t*, const ctype<wchar_t>&, wchar_t);
00147 #endif
00148 extern void _STLP_CALL __adjust_float_buffer(char*, char*, char);
00149 
00150 extern char* _STLP_CALL
00151 __write_integer(char* buf, ios_base::fmtflags flags, long x);
00152 
00153 extern ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int);
00154 #  ifndef _STLP_NO_WCHAR_T
00155 extern ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int);
00156 #  endif
00157 
00158 # endif
00159 
00160 # if defined (__BORLANDC__) && defined (_RTLDLL)
00161 inline void _Stl_loc_init_num_put() {
00162   
00163   num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 14;
00164   num_put<char, char*>::id._M_index = 15;
00165   
00166 # ifndef _STLP_NO_WCHAR_T
00167   num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > ::id._M_index = 33;
00168   num_put<wchar_t, wchar_t*>::id._M_index = 34;
00169 # endif
00170   
00171 }
00172  
00173 # endif
00174 
00175 _STLP_END_NAMESPACE
00176 
00177 #  if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && ! defined (_STLP_LINK_TIME_INSTANTIATION)
00178 #   include <stl/_num_put.c>
00179 #  endif
00180 
00181 #endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */
00182 
00183 // Local Variables:
00184 // mode:C++
00185 // End:
00186 

Generated on Mon Jun 5 10:20:46 2006 for Intelligence.kdevelop by  doxygen 1.4.6