1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
/* Copyright (C) 2005 Garrett A. Kajmowicz
This file is part of the uClibc++ Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <exception>
#include <ios>
#ifndef __STD_IOMANIP
#define __STD_IOMANIP 1
#pragma GCC visibility push(default)
namespace std{
// These are the helper classes which we are going to be using to
// hold the required data
class _UCXXEXPORT __resetiosflags{
public:
ios_base::fmtflags m;
_UCXXEXPORT __resetiosflags(ios_base::fmtflags mask) : m(mask){ }
};
class _UCXXEXPORT __setiosflags{
public:
ios_base::fmtflags m;
_UCXXEXPORT __setiosflags(ios_base::fmtflags mask) : m(mask){ }
};
class _UCXXEXPORT __setbase{
public:
int base;
_UCXXEXPORT __setbase(int b) : base(b){ }
};
class _UCXXEXPORT __setfill{
public:
int character;
_UCXXEXPORT __setfill(int c): character(c){ }
};
class _UCXXEXPORT __setprecision{
public:
int digits;
_UCXXEXPORT __setprecision(int n): digits(n) { }
};
class _UCXXEXPORT __setw{
public:
int width;
_UCXXEXPORT __setw(int n): width(n) { }
};
//Actual manipulator functions
inline __resetiosflags resetiosflags(ios_base::fmtflags mask){
return __resetiosflags(mask);
}
inline __setiosflags setiosflags(ios_base::fmtflags mask){
return __setiosflags(mask);
}
inline __setbase setbase(int b){
return __setbase(b);
}
inline __setfill setfill(int c){
return __setfill(c);
}
inline __setprecision setprecision(int n){
return __setprecision(n);
}
inline __setw setw(int n){
return __setw(n);
}
//How to handle interaction with [i|o]stream classes
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
operator<<(basic_ostream<Ch, Tr>& os, const __resetiosflags s)
{
os.setf(ios_base::fmtflags(0),s.m);
return os;
}
template<class Ch, class Tr> _UCXXEXPORT basic_istream<Ch, Tr>&
operator>>(basic_istream<Ch, Tr>& is, const __resetiosflags s)
{
is.setf(ios_base::fmtflags(0),s.m);
return is;
}
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
operator<<(basic_ostream<Ch, Tr>& os, const __setiosflags s)
{
os.setf(s.m);
return os;
}
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
operator<<(basic_ostream<Ch, Tr>& os, const __setbase s)
{
ios_base::fmtflags f(0);
switch(s.base){
case 8:
f = ios_base::oct;
break;
case 10:
f = ios_base::dec;
break;
case 16:
f = ios_base::hex;
break;
default:
break;
}
os.setf(f, ios_base::basefield);
return os;
}
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
operator<<(basic_ostream<Ch, Tr>& os, const __setfill s)
{
os.fill(s.character);
return os;
}
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
operator<<(basic_ostream<Ch, Tr>& os, const __setprecision s)
{
os.precision(s.digits);
return os;
}
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
operator<<(basic_ostream<Ch, Tr>& os, const __setw s)
{
os.width(s.width);
return os;
}
}
#pragma GCC visibility pop
#endif
|