Standard C++ Library
Copyright 1998, Rogue Wave Software, Inc.
NAME
smanip, smanip_fill
- Helper classes used to implement parameterized manipula-
tors.
SYNOPSIS
#include <iomanip>
template<class T> class smanip;
template<class T, class traits> class smanip_fill;
DESCRIPTION
The template classes smanip and smanip_fill_are helper
classes used to implement parameterized manipulators. The
class smanip_is used as the return type for manipulators
that do not need to carry information about the character
type of the stream they are applied to. This is the case for
resetiosflags, setiosflags, setbase, setprecision, and setw.
The class smanip_fill_is used as the return type for manipu-
lators that do need to carry information about the character
type of the streamto which they are applied. This is the
case for setfill.
smanip_fill is not described in the C++ standard, and is
included as an extension.
INTERFACE
template<class T>
class smanip {
public:
smanip(ios_base& (*pf) (ios_base&, T), T manarg);
};
template<class T, class traits>
class smanip_fill {
public:
smanip_fill(basic_ios<T, traits>& (*pf)
(basic_ios<T, traits>&, T), T manarg);
};
// parameterized manipulators
smanip<ios_base::fmtflags>
resetiosflag(ios_base::fmtflags mask);
smanip<ios_base::fmtflags>
setiosflag(ios_base::fmtflags mask);
smanip<int> setbase(int base);
smanip<int> setprecision(int n);
smanip<int> setw(int n);
template <class charT>
smanip_fill<charT, char_traits<charT> > setfill(charT c);
// overloaded extractors
template <class charT, class traits, class T>
basic_istream<charT,traits>&
operator>>(basic_istream<charT,traits>& is,
const smanip<T>& a);
template <class charT, class traits>
basic_istream<charT,traits>&
operator>>(basic_istream<charT,traits>& is,
const smanip_fill<charT,char_traits<charT> >& a);
// overloaded inserters
template <class charT, class traits, class T>
basic_ostream<charT,traits>&
operator<<(basic_ostream<charT,traits>& is,
const smanip<T>& a);
template <class charT, class traits>
basic_ostream<charT,traits>&
operator>>(basic_ostream<charT,traits>& is,
const smanip_fill<charT,char_traits<charT> >& a);
CLASS SMANIP CONSTRUCTOR
smanip(ios_base& (*pf) (ios_base&, T), T manarg);
Constructs an object of class smanip that stores a func-
tion pointer pf that is called with argument manarg, in
order to perform the manipulator task. The call to pf is
performed in the inserter or extractor overloaded on type
smanip.
CLASS SMANIP_FILL CONSTRUCTOR
smanip_fill(basic_ios<T, traits>& (*pf) (basic_ios<T,
traits>&, T), T manarg);
Constructs an object of class smanip_fill that stores a
function pointer pf, that is called with argument manarg,
in order to perform the manipulator task. The call to pf
is performed in the inserter or extractor overloaded on
type smanip_fill.
MANIPULATORS
smanip<ios_base::fmtflags>
resetiosflag(ios_base::fmtflags mask);
Resets the ios_base::fmtflags designated by mask in the
stream to which it is applied.
smanip<int>
setbase(int base);
Sets the base for the output or input of integer values
in the stream to which it is applied. The valid values
for mask are 8, 10, 16.
template <class charT>
smanip_fill<charT, char_traits<charT> >
setfill(charT c);
Sets the fill character in the stream to which it is
applied.
smanip<ios_base::fmtflags>
setiosflag(ios_base::fmtflags mask);
Sets the ios_base::fmtflags designated by mask in the
stream to which it is applied.
smanip<int>
setprecision(int n);
Sets the precision for the output of floating point
values in the stream to which it is applied.
smanip<int>
setw(int n);
Set the field width in the stream to which it is applied.
EXTRACTORS
template <class charT, class traits, class T>
basic_istream<charT,traits>&
operator>>(basic_istream<charT,traits>& is, const smanip<T>&
a);
Applies the function stored in the parameter of type
smanip<T>, on the stream is.
template <class charT, class traits>
basic_istream<charT,traits>&
operator>>(basic_istream<charT,traits>& is,
const smanip_fill<charT,char_traits<charT> >& a);
Applies the function stored in the parameter of type
smanip_fill<charT, char_traits<charT> > on the stream is.
INSERTERS
template <class charT, class traits, class T>
basic_ostream<charT,traits>&
operator<<(basic_ostream<charT,traits>& os,
const smanip<T>& a);
Applies the function stored in the parameter of type
smanip<T> on the stream os.
template <class charT, class traits>
basic_ostream<charT,traits>&
operator<<(basic_ostream<charT,traits>& os,
const smanip_fill<charT,char_traits<charT> >& a);
Applies the function stored in the parameter of type
smanip_fill<charT, char_traits<charT> > on the stream os.
SEE ALSO
ios_base(3C++), basic_ios(3C++), basic_istream(3C++),
basic_ostream(3C++)
Working Paper for Draft Proposed International Standard for
Information Systems--Programming Language C++, Section
27.6.3
STANDARDS CONFORMANCE
ANSI X3J16/ISO WG21 Joint C++ Committee