summaryrefslogtreecommitdiff
path: root/static/unix-v10/man3/manip.3
blob: 70adfcbcfec8abe1a5575fcbf86cd15e3b288f03 (plain)
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
.  \"ident	"%W%"
.  \"Copyright (c) 1984 AT&T
.  \"All Rights Reserved
.  \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
.  \"The copyright notice above does not evidence any
.  \"actual or intended publication of such source code.
.TH MANIP 3I+ "C++ Stream Library" " "
.SH NAME
manipulators \- iostream out of band manipulations
.SH SYNOPSIS
.ft B
.ta1i 2i
.nf
#include <iostream.h>
#include <iomanip.h>

IOMANIPdeclare(T) ;

class SMANIP(T) {
	SMANIP(T)( ios& (*)(ios&,T), T);
};

class SAPP(T) {
	SAPP(T)( ios& (*)(ios&,T));
	SMANIP(T) operator()(T);
};

ios& SMANIP(T)::operator<<(ios&);
ios& SMANIP(T)::operator>>(ios&);
istream& SMANIP(T)::operator>>(istream&);
ostream& SMANIP(T)::operator<<(ostream&);
iostream& SMANIP(T)::operator<<(iostream&);
iostream& SMANIP(T)::operator>>(iostream&);

class IMANIP(T) {
	IMANIP(T)( istream& (*)(istream&,T), T);
};

class IAPP(T) {
	IAPP(T)( istream& (*)(istream&,T));
	IMANIP(T) operator()(T);
};

istream& operator>>(IMANIP(T), istream&);

class OMANIP(T) {
	OMANIP(T)( ostream& (*)(ostream&,T), T);
};

class OAPP(T) {
	OAPP(T)( ostream& (*)(ostream&,T));
	OMANIP(T) operator()(T);
};

ostream& operator<<(OMANIP(T), ostream&);

class IOMANIP(T) {
	IOMANIP(T)( ios& (*)(ios&,T), T);
};

class IOAPP(T) {
	IOAPP(T)( ios& (*)(ios&,T));
	IOMANIP(T) operator()(T);
};

iostream& operator<<(SMANIP(T), iostream&);
iostream& operator>>(SMANIP(T), iostream&);


IOMANIPdeclare(int) ;

IOMANIP(int)	setbase(int b)	;
IOMANIP(int)	setw(int w) ;
.fi
.ft R
.SH DESCRIPTION
Manipulators are values that may be "inserted into" or
"extracted from" streams in order to achieve some effect
(other than to insert a representation of their value).
Ideally the types relating to manipulators would be parameterized
as "templates".
The macros defined in \f(CWiomanip.h\fR are used to simulate a templates.
\BIOMANIP(T)\fR declares 
the various classes and operators. (All code is declared as inlines
so that no separate definitions are required.)  Each of the other
\fBT\fR is used to construct the real names and therefore
must be a single
identifer.  Each of the other macros also requires an identifier
and expands to a name.
.br
\(em \fBt\fR is a \fBT\fR.
.br
\(em \fBs\fR is an \f(CWios\fR.
.br
\(em \fBi\fR is an \f(CWistream\fR.
.br
\(em \fBo\fR is an \f(CWostream\fR.
.br
\(em \fBio\fR is an \f(CWiostream\fR.
.br
\(em \fBf\fR is an \f(CWios& (*)(ios&)\fR.
.br
\(em \fBif\fR is an \f(CWistream& (*)(istream&)\fR.
.br
\(em \fBof\fR is an \f(CWostream& (*)(ostream&)\fR.
.br
\(em \fBiof\fR is an \f(CWiostream& (*)(iostream&)\fR.
.TP
\fBs<<SMANIP(T)(f,t)\fR
.nf
.in -.5i
\fBs<<SMANIP(T)(f,t)\fR
\fBs>>SMANIP(T)(f,t)\fR
\fBs<<SAPP(T)(f)(t)\fR
\fBs>>SAPP(T)(f)(t)\fR
\fBi>>SMANIP(T)(if,t)\fR
\fBi>>SAPP(T)(if)(t)\fR
\fBo<<SMANIP(T)(of,t)\fR
\fBo<<SAPP(T)(of)(t)\fR
\fBio<<SMANIP(T)(iof,t)\fR
\fBio>>SMANIP(T)(iof,t)\fR
\fBio<<SAPP(T)(iof)(t)\fR
\fBio>>SAPP(T)(iof)(t)\fR
.in
.fi
Returns \fBfct(s,t)\fR, where \fBs\fR is the left operand of
the insertion or extractor operator and \fBfct\fR is \fBf\fR,
\fBif\R, \fBof\fR or \fBiof\fR.
.sp
.nf
.in -.5i
\fBi>>IMANIP(T)(if,t)\fR
\fBi>>IAPP(T)(if)(t)\fR
.in
.fi
Return \fBif(i,t)\fR.
.sp
.nf
.in -.5i
\fBo<<OMANIP(T)(of,t)\fR
\fBo<<OAPP(T)(of)(t)\fR
.in
.fi
Return \fBof(i,t)\fR.
.sp
.nf
.in -.5i
\fBio<<IOMANIP(T)(iof,t)\fR
\fBio>>IOMANIP(T)(iof,t)\fR
\fBio<<IOAPP(T)(iof)(t)\fR
\fBio>>IOAPP(T)(iof)(t)\fR
.in
.fi
Return \fBiof(s,t)\fR.
.PP
\f(CWiomanip.h\fR contains a declaration, \f(CWIOMANIPdeclare(int)\fR
and some functions:
.sp
.nf
.in -.5i
\fBo<<setbase(n)\fR
\fBi>>setbase(n)\fR
\fBio<<setbase(n)\fR
\fBio>>setbase(n)\fR
.in
.fi
Sets the conversion base of the stream (left hand operand) to \fBn\fR.
.sp
.nf
.in -.5i
\fBo<<setw(n)\fR
\fBi>>setw(n)\fR
\fBio<<setw(n)\fR
\fBio>>setw(n)\fR
.in
.fi
Sets the \f(CWwidth\fR format state variable
the stream (left hand operand) to \fBn\fR.
.SH CAVEATS
Syntax errors will be reported if
\fBIOMANIP(T)\fR occurs more than once in a file with the
same \fBT\fR.
.SH SEE ALSO
ios(3C++)
istream(3C++)
ostream(3C++)