ReactOS 0.4.15-dev-8348-gc1b9bb5
_iomanip.h
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
19#ifndef _STLP_INTERNAL_IOMANIP
20#define _STLP_INTERNAL_IOMANIP
21
22#ifndef _STLP_INTERNAL_ISTREAM
23# include <stl/_istream.h> // Includes <ostream> and <ios>
24#endif
25
27
29
30//----------------------------------------------------------------------
31// Machinery for defining manipulators.
32
33// Class that calls one of ios_base's single-argument member functions.
34template <class _Arg>
36 typedef _Arg (ios_base::*__f_ptr_type)(_Arg);
37
38 _Ios_Manip_1(__f_ptr_type __f, const _Arg& __arg)
39 : _M_f(__f), _M_arg(__arg) {}
40
41 void operator()(ios_base& __ios) const
42 { (__ios.*_M_f)(_M_arg); }
43
45 _Arg _M_arg;
46};
47
48// Class that calls one of ios_base's two-argument member functions.
53
55 : _M_flag(__f), _M_mask(0), _M_two_args(false) {}
56
58 : _M_flag(__f), _M_mask(__m), _M_two_args(true) {}
59
60 void operator()(ios_base& __ios) const {
61 if (_M_two_args)
62 __ios.setf(_M_flag, _M_mask);
63 else
64 __ios.setf(_M_flag);
65 }
66};
67
69
70template <class _CharT, class _Traits, class _Arg>
73 const _STLP_PRIV _Ios_Manip_1<_Arg>& __f) {
74 __f(__istr);
75 return __istr;
76}
77
78template <class _CharT, class _Traits, class _Arg>
81 const _STLP_PRIV _Ios_Manip_1<_Arg>& __f) {
82 __f(__os);
83 return __os;
84}
85
86template <class _CharT, class _Traits>
89 const _STLP_PRIV _Ios_Setf_Manip& __f) {
90 __f(__istr);
91 return __istr;
92}
93
94template <class _CharT, class _Traits>
97 const _STLP_PRIV _Ios_Setf_Manip& __f) {
98 __f(__os);
99 return __os;
100}
101
102//----------------------------------------------------------------------
103// The ios_base manipulators.
105{ return _STLP_PRIV _Ios_Setf_Manip(0, __mask); }
106
108{ return _STLP_PRIV _Ios_Setf_Manip(__flag); }
109
111 ios_base::fmtflags __base = __n == 8 ? ios_base::oct :
112 __n == 10 ? ios_base::dec :
113 __n == 16 ? ios_base::hex :
115 return _STLP_PRIV _Ios_Setf_Manip(__base, ios_base::basefield);
116}
117
122}
123
125setw(int __n) {
128}
129
130//----------------------------------------------------------------------
131// setfill, a manipulator that operates on basic_ios<> instead of ios_base.
132
134
135template <class _CharT>
138 _CharT _M_c;
139};
140
142
143template <class _CharT, class _CharT2, class _Traits>
147 __os.fill(__m._M_c);
148 return __os;
149}
150
151template <class _CharT, class _CharT2, class _Traits>
155 __is.fill(__m._M_c);
156 return __is;
157}
158
159template <class _CharT>
162
164
165#endif /* _STLP_INTERNAL_IOMANIP */
return __n
Definition: _algo.h:75
#define _STLP_CALL
Definition: _bc.h:131
#define _STLP_PRIV
Definition: _dm.h:70
_STLP_PRIV _Ios_Manip_1< streamsize > _STLP_CALL setw(int __n)
Definition: _iomanip.h:125
_STLP_PRIV _Ios_Setf_Manip _STLP_CALL resetiosflags(ios_base::fmtflags __mask)
Definition: _iomanip.h:104
_STLP_MOVE_TO_STD_NAMESPACE basic_istream< _CharT, _Traits > &_STLP_CALL operator>>(basic_istream< _CharT, _Traits > &__istr, const _STLP_PRIV _Ios_Manip_1< _Arg > &__f)
Definition: _iomanip.h:72
_STLP_PRIV _Setfill_Manip< _CharT > _STLP_CALL setfill(_CharT __c)
Definition: _iomanip.h:160
_STLP_PRIV _Ios_Setf_Manip _STLP_CALL setiosflags(ios_base::fmtflags __flag)
Definition: _iomanip.h:107
_STLP_PRIV _Ios_Setf_Manip _STLP_CALL setbase(int __n)
Definition: _iomanip.h:110
_STLP_PRIV _Ios_Manip_1< streamsize > _STLP_CALL setprecision(int __n)
Definition: _iomanip.h:119
basic_ostream< _CharT, _Traits > &_STLP_CALL operator<<(basic_ostream< _CharT, _Traits > &__os, const _STLP_PRIV _Ios_Manip_1< _Arg > &__f)
Definition: _iomanip.h:80
char_type fill() const
Definition: _ios.h:81
fmtflags setf(fmtflags __flag)
Definition: _ios_base.h:114
streamsize width() const
Definition: _ios_base.h:134
int fmtflags
Definition: _ios_base.h:57
streamsize precision() const
Definition: _ios_base.h:127
#define _STLP_MOVE_TO_STD_NAMESPACE
Definition: features.h:525
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
#define _STLP_END_NAMESPACE
Definition: features.h:503
#define _STLP_MOVE_TO_PRIV_NAMESPACE
Definition: features.h:524
#define __c
Definition: schilyio.h:209
#define true
Definition: stdbool.h:36
#define false
Definition: stdbool.h:37
_Ios_Manip_1(__f_ptr_type __f, const _Arg &__arg)
Definition: _iomanip.h:38
_Arg(ios_base::* __f_ptr_type)(_Arg)
Definition: _iomanip.h:36
void operator()(ios_base &__ios) const
Definition: _iomanip.h:41
_Arg _M_arg
Definition: _iomanip.h:45
__f_ptr_type _M_f
Definition: _iomanip.h:44
_Ios_Setf_Manip(ios_base::fmtflags __f, ios_base::fmtflags __m)
Definition: _iomanip.h:57
bool _M_two_args
Definition: _iomanip.h:52
ios_base::fmtflags _M_flag
Definition: _iomanip.h:50
void operator()(ios_base &__ios) const
Definition: _iomanip.h:60
ios_base::fmtflags _M_mask
Definition: _iomanip.h:51
_Ios_Setf_Manip(ios_base::fmtflags __f)
Definition: _iomanip.h:54
_Setfill_Manip(_CharT __c)
Definition: _iomanip.h:137
_CharT _M_c
Definition: _iomanip.h:138