1
/* Copyright (C) 2005 Garrett A. Kajmowicz
3
This file is part of the uClibc++ Library.
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
#define __STD_IOMANIP 1
26
#pragma GCC visibility push(default)
30
// These are the helper classes which we are going to be using to
31
// hold the required data
33
class _UCXXEXPORT __resetiosflags{
36
_UCXXEXPORT __resetiosflags(ios_base::fmtflags mask) : m(mask){ }
39
class _UCXXEXPORT __setiosflags{
42
_UCXXEXPORT __setiosflags(ios_base::fmtflags mask) : m(mask){ }
45
class _UCXXEXPORT __setbase{
48
_UCXXEXPORT __setbase(int b) : base(b){ }
51
class _UCXXEXPORT __setfill{
54
_UCXXEXPORT __setfill(int c): character(c){ }
57
class _UCXXEXPORT __setprecision{
60
_UCXXEXPORT __setprecision(int n): digits(n) { }
63
class _UCXXEXPORT __setw{
66
_UCXXEXPORT __setw(int n): width(n) { }
70
//Actual manipulator functions
72
inline __resetiosflags resetiosflags(ios_base::fmtflags mask){
73
return __resetiosflags(mask);
76
inline __setiosflags setiosflags(ios_base::fmtflags mask){
77
return __setiosflags(mask);
80
inline __setbase setbase(int b){
84
inline __setfill setfill(int c){
88
inline __setprecision setprecision(int n){
89
return __setprecision(n);
92
inline __setw setw(int n){
97
//How to handle interaction with [i|o]stream classes
99
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
100
operator<<(basic_ostream<Ch, Tr>& os, const __resetiosflags s)
102
os.setf(ios_base::fmtflags(0),s.m);
106
template<class Ch, class Tr> _UCXXEXPORT basic_istream<Ch, Tr>&
107
operator>>(basic_istream<Ch, Tr>& is, const __resetiosflags s)
109
is.setf(ios_base::fmtflags(0),s.m);
113
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
114
operator<<(basic_ostream<Ch, Tr>& os, const __setiosflags s)
120
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
121
operator<<(basic_ostream<Ch, Tr>& os, const __setbase s)
123
ios_base::fmtflags f(0);
138
os.setf(f, ios_base::basefield);
142
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
143
operator<<(basic_ostream<Ch, Tr>& os, const __setfill s)
145
os.fill(s.character);
149
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
150
operator<<(basic_ostream<Ch, Tr>& os, const __setprecision s)
152
os.precision(s.digits);
156
template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
157
operator<<(basic_ostream<Ch, Tr>& os, const __setw s)
167
#pragma GCC visibility pop