ReactOS 0.4.15-dev-7942-gd23573b
_ios.c
Go to the documentation of this file.
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#ifndef _STLP_IOS_C
19#define _STLP_IOS_C
20
21#ifndef _STLP_INTERNAL_IOS_H
22# include <stl/_ios.h>
23#endif
24
25#ifndef _STLP_INTERNAL_STREAMBUF
26# include <stl/_streambuf.h>
27#endif
28
29#ifndef _STLP_INTERNAL_NUMPUNCT_H
30# include <stl/_numpunct.h>
31#endif
32
34
35// basic_ios<>'s non-inline member functions
36
37// Public constructor, taking a streambuf.
38template <class _CharT, class _Traits>
41 : ios_base(), _M_cached_ctype(0),
42 _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) {
44}
45
46template <class _CharT, class _Traits>
49 basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf;
50 _M_streambuf = __buf;
51 this->clear();
52 return __tmp;
53}
54
55template <class _CharT, class _Traits>
58 _M_invoke_callbacks(erase_event);
59 _M_copy_state(__x); // Inherited from ios_base.
60 _M_cached_ctype = __x._M_cached_ctype;
61 _M_fill = __x._M_fill;
62 _M_tied_ostream = __x._M_tied_ostream;
63 _M_invoke_callbacks(copyfmt_event);
64 this->_M_set_exception_mask(__x.exceptions());
65 return *this;
66}
67
68template <class _CharT, class _Traits>
70 locale __tmp = ios_base::imbue(__loc);
71 _STLP_TRY {
72 if (_M_streambuf)
73 _M_streambuf->pubimbue(__loc);
74
75 // no throwing here
76 _M_cached_ctype = &use_facet<ctype<char_type> >(__loc);
77 }
79 __tmp = ios_base::imbue(__tmp);
80 _M_handle_exception(ios_base::failbit);
81 }
82 return __tmp;
83}
84
85// Protected constructor and initialization functions. The default
86// constructor creates an uninitialized basic_ios, and init() initializes
87// all of the members to the values in Table 89 of the C++ standard.
88
89template <class _CharT, class _Traits>
91 : ios_base(),
92 _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0)
93{}
94
95template <class _CharT, class _Traits>
96void
98{
99 this->rdbuf(__sb);
100 this->imbue(locale());
101 this->tie(0);
102 this->_M_set_exception_mask(ios_base::goodbit);
103 this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit);
104 ios_base::flags(ios_base::skipws | ios_base::dec);
107 this->fill(widen(' '));
108 // We don't need to worry about any of the three arrays: they are
109 // initialized correctly in ios_base's constructor.
110}
111
112// This is never called except from within a catch clause.
113template <class _CharT, class _Traits>
115{
116 this->_M_setstate_nothrow(__flag);
117 if (this->_M_get_exception_mask() & __flag)
119}
120
122
123#endif /* _STLP_IOS_C */
125// Local Variables:
126// mode:C++
127// End:
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algobase.h:449
#define _STLP_NULL_CHAR_INIT(_ChT)
Definition: char_traits.h:55
Definition: _ios.h:48
iostate exceptions() const
Definition: _ios.h:97
basic_ios< _CharT, _Traits > & copyfmt(const basic_ios< _CharT, _Traits > &__x)
Definition: _ios.c:57
basic_streambuf< _CharT, _Traits > * rdbuf() const
Definition: _ios.h:72
basic_ios()
Definition: _ios.c:90
locale imbue(const locale &)
Definition: _ios.c:69
char_type _M_fill
Definition: _ios.h:135
void init(basic_streambuf< _CharT, _Traits > *__streambuf)
Definition: _ios.c:97
basic_ostream< _CharT, _Traits > * _M_tied_ostream
Definition: _ios.h:138
const ctype< char_type > * _M_cached_ctype
Definition: _ios.h:117
void _M_handle_exception(ios_base::iostate __flag)
Definition: _ios.c:114
fmtflags flags() const
Definition: _ios_base.h:107
streamsize width() const
Definition: _ios_base.h:134
int iostate
Definition: _ios_base.h:58
streamsize precision() const
Definition: _ios_base.h:127
locale imbue(const locale &)
Definition: ios.cpp:122
Definition: _locale.h:75
#define _STLP_RETHROW
Definition: features.h:822
#define _STLP_TRY
Definition: features.h:817
#define _STLP_CATCH_ALL
Definition: features.h:818
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
#define _STLP_END_NAMESPACE
Definition: features.h:503