1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Istream and Ostream manipulators taking arguments.
31 \*---------------------------------------------------------------------------*/
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 // Forward declaration of friend functions and operators
46 template<class T> class Smanip;
47 template<class T> class Imanip;
48 template<class T> class Omanip;
51 inline Istream& operator>>(Istream& is, const Smanip<T>& m);
54 inline Ostream& operator<<(Ostream& os, const Smanip<T>& m);
57 inline Istream& operator>>(Istream& is, const Imanip<T>& m);
60 inline Ostream& operator<<(Ostream& os, const Omanip<T>& m);
63 /*---------------------------------------------------------------------------*\
64 Class Smanip Declaration
65 \*---------------------------------------------------------------------------*/
70 T (IOstream::*_fPtr)(const T);
75 Smanip(T (IOstream::*fPtr)(const T), const T i)
81 friend Istream& operator>> <T>(Istream& is, const Smanip<T>& m);
82 friend Ostream& operator<< <T>(Ostream& os, const Smanip<T>& m);
87 inline Istream& operator>>(Istream& is, const Smanip<T>& m)
95 inline Ostream& operator<<(Ostream& os, const Smanip<T>& m)
102 /*---------------------------------------------------------------------------*\
103 Class Imanip Declaration
104 \*---------------------------------------------------------------------------*/
109 T (Istream::*_fPtr)(const T);
114 Imanip(T (Istream::*fPtr)(const T), const T i)
120 friend Istream& operator>> <T>(Istream& is, const Imanip<T>& m);
125 inline Istream& operator>>(Istream& is, const Imanip<T>& m)
132 /*---------------------------------------------------------------------------*\
133 Class Omanip Declaration
134 \*---------------------------------------------------------------------------*/
139 T (Ostream::*_fPtr)(const T);
144 Omanip(T (Ostream::*fPtr)(const T), const T i)
150 friend Ostream& operator<< <T>(Ostream& os, const Omanip<T>& m);
155 inline Ostream& operator<<(Ostream& os, const Omanip<T>& m)
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 inline Smanip<ios_base::fmtflags> setf
166 const ios_base::fmtflags flags
169 return Smanip<ios_base::fmtflags>(&IOstream::setf, flags);
173 inline Omanip<IOstream::streamFormat> setformat
175 const IOstream::streamFormat fmt
178 return Omanip<IOstream::streamFormat>(&IOstream::format, fmt);
182 inline Omanip<IOstream::versionNumber> setversion
184 const IOstream::versionNumber ver
187 return Omanip<IOstream::versionNumber>(&IOstream::version, ver);
191 inline Omanip<IOstream::compressionType> setcompression
193 const IOstream::compressionType cmp
196 return Omanip<IOstream::compressionType>(&IOstream::compression, cmp);
200 inline Omanip<int> setw(const int i)
202 return Omanip<int>(&Ostream::width, i);
206 inline Omanip<int> setprecision(const int i)
208 return Omanip<int>(&Ostream::precision, i);
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 } // End namespace Foam
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 // ************************************************************************* //