00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _STLP_INTERNAL_IOS_H
00019 #define _STLP_INTERNAL_IOS_H
00020
00021
00022 #ifndef _STLP_IOS_BASE_H
00023 # include <stl/_ios_base.h>
00024 #endif
00025
00026 #ifndef _STLP_INTERNAL_CTYPE_H
00027 # include <stl/_ctype.h>
00028 #endif
00029 #ifndef _STLP_INTERNAL_NUMPUNCT_H
00030 # include <stl/_numpunct.h>
00031 #endif
00032
00033 _STLP_BEGIN_NAMESPACE
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 template <class _CharT, class _Traits>
00047 class basic_ios : public ios_base {
00048 friend class ios_base;
00049 public:
00050 typedef _CharT char_type;
00051 typedef typename _Traits::int_type int_type;
00052 typedef typename _Traits::pos_type pos_type;
00053 typedef typename _Traits::off_type off_type;
00054 typedef _Traits traits_type;
00055
00056 public:
00057 explicit basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf);
00058 virtual ~basic_ios() {}
00059
00060 public:
00061 basic_ostream<_CharT, _Traits>* tie() const {
00062 return _M_tied_ostream;
00063 }
00064 basic_ostream<_CharT, _Traits>*
00065 tie(basic_ostream<char_type, traits_type>* __new_tied_ostream) {
00066 basic_ostream<char_type, traits_type>* __tmp = _M_tied_ostream;
00067 _M_tied_ostream = __new_tied_ostream;
00068 return __tmp;
00069 }
00070
00071 basic_streambuf<_CharT, _Traits>* rdbuf() const
00072 { return _M_streambuf; }
00073
00074 basic_streambuf<_CharT, _Traits>*
00075 rdbuf(basic_streambuf<char_type, traits_type>*);
00076
00077
00078 basic_ios<_CharT, _Traits>& copyfmt(const basic_ios<_CharT, _Traits>& __x);
00079
00080 char_type fill() const { return _M_fill; }
00081 char_type fill(char_type __fill) {
00082 char_type __tmp(_M_fill);
00083 _M_fill = __fill;
00084 return __tmp;
00085 }
00086
00087 public:
00088
00089
00090 void clear(iostate __state = goodbit) {
00091 _M_clear_nothrow(this->rdbuf() ? __state : iostate(__state|ios_base::badbit));
00092 _M_check_exception_mask();
00093 }
00094 void setstate(iostate __state) { this->clear(rdstate() | __state); }
00095
00096 iostate exceptions() const { return this->_M_get_exception_mask(); }
00097 void exceptions(iostate __mask) {
00098 this->_M_set_exception_mask(__mask);
00099 this->clear(this->rdstate());
00100 }
00101
00102 public:
00103 locale imbue(const locale&);
00104
00105 inline char narrow(_CharT, char) const ;
00106 inline _CharT widen(char) const;
00107
00108
00109 static bool _STLP_CALL _S_eof(int_type __c) {
00110 const int_type __eof = _Traits::eof();
00111 return _Traits::eq_int_type(__c, __eof);
00112 }
00113
00114 protected:
00115 basic_ios();
00116
00117 void init(basic_streambuf<_CharT, _Traits>* __streambuf);
00118
00119 public:
00120
00121
00122
00123 void _M_handle_exception(ios_base::iostate __flag);
00124
00125 private:
00126 char_type _M_fill;
00127
00128 basic_streambuf<_CharT, _Traits>* _M_streambuf;
00129 basic_ostream<_CharT, _Traits>* _M_tied_ostream;
00130
00131 };
00132
00133
00134 template <class _CharT, class _Traits>
00135 inline char
00136 basic_ios<_CharT, _Traits>::narrow(_CharT __c, char __default) const
00137 { return ((const ctype<_CharT>*)this->_M_ctype_facet())->narrow(__c, __default); }
00138
00139 template <class _CharT, class _Traits>
00140 inline _CharT
00141 basic_ios<_CharT, _Traits>::widen(char __c) const
00142 {
00143 return ((const ctype<_CharT>*)this->_M_ctype_facet())->widen(__c); }
00144
00145 # if defined (_STLP_USE_TEMPLATE_EXPORT)
00146 _STLP_EXPORT_TEMPLATE_CLASS basic_ios<char, char_traits<char> >;
00147 # if ! defined (_STLP_NO_WCHAR_T)
00148 _STLP_EXPORT_TEMPLATE_CLASS basic_ios<wchar_t, char_traits<wchar_t> >;
00149 # endif
00150 # endif
00151
00152 # if !defined (_STLP_NO_METHOD_SPECIALIZATION)
00153 _STLP_TEMPLATE_NULL
00154 inline char
00155 basic_ios<char, char_traits<char> >::narrow(char __c, char) const
00156 {
00157 return __c;
00158 }
00159
00160 _STLP_TEMPLATE_NULL
00161 inline char
00162 basic_ios<char, char_traits<char> >::widen(char __c) const
00163 {
00164 return __c;
00165 }
00166 # endif
00167
00168
00169 _STLP_END_NAMESPACE
00170
00171 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
00172 # include <stl/_ios.c>
00173 # endif
00174
00175
00176
00177
00178
00179 #if defined(__BORLANDC__) && defined(_RTLDLL)
00180 # ifndef _STLP_INTERNAL_NUM_PUT_H
00181 # include <stl/_num_put.h>
00182 # endif
00183 # ifndef _STLP_INTERNAL_NUM_GET_H
00184 # include <stl/_num_get.h>
00185 # endif
00186 # ifndef _STLP_INTERNAL_MONETARY_H
00187 # include <stl/_monetary.h>
00188 # endif
00189 # ifndef _STLP_INTERNAL_TIME_FACETS_H
00190 # include <stl/_time_facets.h>
00191 # endif
00192 #endif
00193
00194 #endif
00195
00196
00197
00198
00199