Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
_iosbase.h
Go to the documentation of this file.
1
32#ifndef _RWSTD_RW_IOSBASE_H_INCLUDED
33#define _RWSTD_RW_IOSBASE_H_INCLUDED
34
35
36#include <loc/_locale.h>
37
38#ifndef _RWSTD_RW_IOSFAILURE_H_INCLUDED
39# include <rw/_iosfailure.h>
40#endif // _RWSTD_RW_IOSFAILURE_H_INCLUDED
41
42#ifndef _RWSTD_RW_IOSFWD_H_INCLUDED
43# include <rw/_iosfwd.h>
44#endif // _RWSTD_RW_IOSFWD_H_INCLUDED
45
46#ifndef _RWSTD_RW_TRAITS_H_INCLUDED
47# include <rw/_traits.h>
48#endif // _RWSTD_RW_TRAITS_H_INCLUDED
49
50
52
53
54struct _RWSTD_EXPORT ios_base: _RW::__rw_synchronized
55{
56 // 27.4.2.1.1
57 typedef _RW::__rw_failure failure;
58
59#ifndef _RWSTD_NO_EXT_FAILURE
60
61 // extensions
62 typedef _RW::__rw_badbit_set badbit_set;
63 typedef _RW::__rw_eofbit_set eofbit_set;
64 typedef _RW::__rw_failbit_set failbit_set;
65
66#endif // _RWSTD_NO_EXT_FAILURE
67
68 // 27.4.2.1.2
69 typedef _RWSTD_BITMASK_ENUM (_RW::__rw_fmtflags) fmtflags;
70
71 // insert and extract bool type in alphabetic format
72 _RWSTD_STATIC_CONST (fmtflags, boolalpha = _RW::__rw_boolalpha);
73
74 // converts integer input or generates integer output in decimal base
75 _RWSTD_STATIC_CONST (fmtflags, dec = _RW::__rw_dec);
76
77 // generate floating-point output in fixed-point notation
78 _RWSTD_STATIC_CONST (fmtflags, fixed = _RW::__rw_fixed);
79
80 // converts integer input or generates integer output in hexadecimal base
81 _RWSTD_STATIC_CONST (fmtflags, hex = _RW::__rw_hex);
82
83 // adds fill characters at a designated internal point in certain generated
84 // output, or identical to right if no such point is designated
85 _RWSTD_STATIC_CONST (fmtflags, internal = _RW::__rw_internal);
86
87 // adds fill characters on the right of certain generated output
88 _RWSTD_STATIC_CONST (fmtflags, left = _RW::__rw_left);
89
90 // converts integer input or generates integer output in octal base
91 _RWSTD_STATIC_CONST (fmtflags, oct = _RW::__rw_oct);
92
93 // adds fill characters on the left of certain generated output
94 _RWSTD_STATIC_CONST (fmtflags, right = _RW::__rw_right);
95
96 // generates floating-point output in scientific notation
97 _RWSTD_STATIC_CONST (fmtflags, scientific = _RW::__rw_scientific);
98
99 // generates a prefix indicating the numeric base of generated integer
100 // output (bin - none, oct - "0", dec - none, hex - "0x")
101 _RWSTD_STATIC_CONST (fmtflags, showbase = _RW::__rw_showbase);
102
103 // generates a decimal-point character unconditionally in generated
104 // floating-point output
105 _RWSTD_STATIC_CONST (fmtflags, showpoint = _RW::__rw_showpoint);
106
107 // generates a + sign in non-negative generated numeric output
108 _RWSTD_STATIC_CONST (fmtflags, showpos = _RW::__rw_showpos);
109
110 // skips leading white space before certain input operations
111 _RWSTD_STATIC_CONST (fmtflags, skipws = _RW::__rw_skipws);
112
113 // flushes output after each output operation
114 _RWSTD_STATIC_CONST (fmtflags, unitbuf = _RW::__rw_unitbuf);
115
116 // replaces certain lowercase letters with their uppercase equivalents
117 // in generated output
118 _RWSTD_STATIC_CONST (fmtflags, uppercase = _RW::__rw_uppercase);
119
120#ifndef _RWSTD_NO_EXT_BIN_IO
121
122 // extension - converts integer input or generates integer output
123 // in binary base
124 _RWSTD_STATIC_CONST (fmtflags, bin = _RW::__rw_bin);
125
126#endif // _RWSTD_NO_EXT_BIN_IO
127
128 _RWSTD_STATIC_CONST (fmtflags, basefield = _RW::__rw_basefield);
129 _RWSTD_STATIC_CONST (fmtflags, adjustfield = _RW::__rw_adjustfield);
130 _RWSTD_STATIC_CONST (fmtflags, floatfield = _RW::__rw_floatfield);
131
132#ifndef _RWSTD_NO_EXT_REENTRANT_IO
133
134 // extension: never locks the object in MT environments
135 _RWSTD_STATIC_CONST (fmtflags, nolock = _RW::__rw_nolock);
136
137 // extension: never locks stream buffer in MT environments
138 _RWSTD_STATIC_CONST (fmtflags, nolockbuf = _RW::__rw_nolockbuf);
139
140#endif // _RWSTD_NO_EXT_REENTRANT_IO
141
142 // 27.4.2.1.3
143 typedef _RWSTD_BITMASK_ENUM (_RW::__rw_iostate) iostate;
144
145 _RWSTD_STATIC_CONST (iostate, goodbit = _RW::__rw_goodbit);
146
147 // indicates a loss of integrity in an input or output sequence
148 // (such as an irrecoverable read error from a file);
149 _RWSTD_STATIC_CONST (iostate, badbit = _RW::__rw_badbit);
150
151 // indicates that an input operation reached the end of an input sequence
152 _RWSTD_STATIC_CONST (iostate, eofbit = _RW::__rw_eofbit);
153
154 // indicates that an input operation failed to read the expected
155 // characters, or that an output operation failed to generate the
156 // desired characters
157 _RWSTD_STATIC_CONST (iostate, failbit = _RW::__rw_failbit);
158
159 // 27.4.2.1.4
160 typedef _RWSTD_BITMASK_ENUM (_RW::__rw_openmode) openmode;
161
162 // seek to end before each write
163 _RWSTD_STATIC_CONST (openmode, app = _RW::__rw_app);
164
165 // perform input and output in binary mode (as opposed to text mode)
166 _RWSTD_STATIC_CONST (openmode, binary = _RW::__rw_binary);
167
168 // open for input
169 _RWSTD_STATIC_CONST (openmode, in = _RW::__rw_in);
170
171 // open for output
172 _RWSTD_STATIC_CONST (openmode, out = _RW::__rw_out);
173
174 // truncate an existing stream when opening
175 _RWSTD_STATIC_CONST (openmode, trunc = _RW::__rw_trunc);
176
177 // open and seek to end immediately after opening
178 _RWSTD_STATIC_CONST (openmode, ate = _RW::__rw_ate);
179
180#ifndef _RWSTD_STRICT_ANSI
181
182 // extensions for compatibility with Classic Iostreams
183
184 // do not create a file if it doesn't exist
185 _RWSTD_STATIC_CONST (openmode, nocreate = _RW::__rw_nocreate);
186
187 // do not replace an existing file
188 _RWSTD_STATIC_CONST (openmode, noreplace = _RW::__rw_noreplace);
189
190#endif // _RWSTD_STRICT_ANSI
191
192#ifndef _RWSTD_NO_EXT_STDIO
193
194 // use the C stdio library for all file I/O
195 _RWSTD_STATIC_CONST (openmode, stdio = _RW::__rw_stdio);
196
197 // use the native OS calls for all file I/O
198 _RWSTD_STATIC_CONST (openmode, native = _RW::__rw_native);
199
200#endif // _RWSTD_NO_EXT_STDIO
201
202 typedef _RWSTD_BITMASK_ENUM (_RW::__rw_seekdir) seekdir;
203
204 // 27.4.2.1.5, p1
205 _RWSTD_STATIC_CONST (seekdir, beg = _RW::__rw_beg);
206 _RWSTD_STATIC_CONST (seekdir, cur = _RW::__rw_cur);
207 _RWSTD_STATIC_CONST (seekdir, end = _RW::__rw_end);
208
209#ifndef _RWSTD_NO_DEPRECATED
210
211 // D.6, p1 (must be integer types and not enums)
212 typedef int seek_dir;
213 typedef int open_mode;
214 typedef int io_state;
215 typedef _RWSTD_STREAMOFF streamoff;
216 typedef _RWSTD_STREAMOFF streampos;
217
218#endif // _RWSTD_NO_DEPRECATED
219
220 // 27.4.2.1.6
221 struct _RWSTD_EXPORT Init {
222 Init ();
223
224 ~Init ();
225 };
226
227 // 27.4.2.2, p1
228 fmtflags flags () const {
229 return fmtflags (_C_fmtfl);
230 }
231
232 // 27.4.2.2, p2
233 fmtflags flags (fmtflags);
234
235 // 27.4.2.2, p4
236 fmtflags setf (fmtflags __f) {
237 return flags (flags () | __f);
238 }
239
240 // 27.4.2.2, p6
241 fmtflags setf (fmtflags __f, fmtflags __mask) {
242 return flags (flags () & ~__mask | __f & __mask);
243 }
244
245 // 27.4.2.2, p8
246 void unsetf (fmtflags __f) {
247 flags (flags () & ~__f);
248 }
249
250 // 27.4.2.2, p9
251 _RWSTD_STREAMSIZE precision () const {
252 return _C_prec;
253 }
254
255 // 27.4.2.2, p10
257
258 // 27.4.2.2, p12
259 _RWSTD_STREAMSIZE width () const {
260 return _C_wide;
261 }
262
263 // 27.4.2.2, p13
265
266 // 27.4.2.3, p1
267 locale imbue (const locale&);
268
269 // extension: avoids reference counting in MT builds (may result in
270 // a speedup of up to 50%); this is an alternative to caching a reference
271 // (pointer) to a facet in each stream and stream buffer object
272 locale& getloc () {
273 return _C_loc;
274 }
275
276 // 27.4.2.3, p4
277 locale getloc () const {
278 return _C_loc;
279 }
280
281 // 27.4.2.5, p1
282 static int xalloc ();
283
284 // 27.4.2.5, p2
285 long& iword (int);
286
287 // 27.4.2.5, p4
288 void*& pword (int);
289
290 enum event { erase_event, imbue_event, copyfmt_event };
291
292 typedef void (*event_callback)(event, ios_base&, int);
293
294 // 27.4.2.6, p1
295 void register_callback (event_callback, int);
296
297 // 27.4.2.4, p1
298 static bool sync_with_stdio (bool = true);
299
300 // 27.4.2.7, p2
301 virtual ~ios_base ();
302
303 // returns a numeric base as per 22.2.2.1.2, p4
304 int _C_base () const {
305 return _RWSTD_STATIC_CAST (unsigned, flags ()) >> _RWSTD_IOS_BASEOFF;
306 }
307
308protected:
309
310 // 27.4.2.7, p1
311 ios_base ();
312
313 // implements basic_ios<T>::init()
314 void _C_init (void*);
315
316 // will be reentrant only if `reentrant' is true
317 void _C_fire_event (event, bool __reentrant);
318
319 // implements basic_ios<T>::copyfmt()
320 void _C_copyfmt (const ios_base&, void*, const void*, _RWSTD_SIZE_T);
321
322 // sets state, exceptions, and rdbuf to the function arguments
323 // in that order (except state & ~_RWSTD_IOS_NOTHROW)
324 // may throw except when _RWSTD_IOS_NOTHROW is set in the first
325 // argument; returns the previous value of rdbuf
326 void* _C_set (unsigned, unsigned, void*);
327
328 // retrieves and sets the tied stream pointer
329 void* _C_tie () const;
330 void* _C_tie (void*);
331
332 // called from basic_ios<>::imbue (), not thread safe
333 locale _C_unsafe_imbue (const locale&);
334
335 void *_C_rdbuf; // pointer to the associated stream buffer
336 _RWSTD_STREAMSIZE _C_prec; // current precision
337 _RWSTD_STREAMSIZE _C_wide; // current width
338 unsigned _C_fmtfl; // formatting flags
339 unsigned char _C_state; // stream state
340 unsigned char _C_except; // active exceptions
341
342 static bool _C_sync_with_stdio;
343
344private:
345
346 ios_base (const ios_base&); // not defined
347 ios_base& operator= (const ios_base&); // not defined
348
349#if __EDG_VERSION__ < 245
350
351 // working around an EDG eccp 2.3x bug (also derivatives,
352 // such as MIPSpro, see PR #28631)
353public:
354 struct _C_usr_data;
355
356#else
357
358protected:
359 struct _C_usr_data;
360
361#endif // EDG < 2.45
362
363protected:
364 _C_usr_data *_C_usr; // user data (iword, pword, callbacks)
365 locale _C_loc; // locale associated with stream
366
367 friend struct _RWSTD_EXPORT Init;
368
369 // working around an EDG eccp 3.2 and prior bug (see PR #29526)
370 friend struct _C_usr_data;
371};
372
373
374inline _RWSTD_STREAMSIZE ios_base::
375width (_RWSTD_STREAMSIZE __width)
376{
377 _RWSTD_ASSERT (0 != this);
378
379 const _RWSTD_STREAMSIZE __tmp = _C_wide;
380
381 // not thread-safe for efficiency since width(0) is called
382 // (directly or through a facet) by each formatted output
383 // function and the return value is not used
384 _C_wide = __width;
385
386 return __tmp;
387}
388
389
390} // namespace std
391
392
393#endif // _RWSTD_RW_IOSBASE_H_INCLUDED
#define floatfield
#define showbase
#define failbit
#define badbit
#define adjustfield
#define unitbuf
#define scientific
#define uppercase
#define left
#define nolock
#define nolockbuf
#define showpoint
#define goodbit
#define dec
#define skipws
#define oct
#define hex
#define bin
#define eofbit
#define boolalpha
#define internal
#define right
#define basefield
#define showpos
#define fixed
#define flags
const int __f
const int end
const int out
const int ate
const int cur
const int in
#define _RWSTD_BITMASK_ENUM(Bitmask)
Definition _bitmask.h:41
#define _RWSTD_EXPORT
Definition _defs.h:485
#define _RWSTD_STATIC_CAST(T, x)
Definition _defs.h:534
#define _RWSTD_NAMESPACE(name)
Definition _defs.h:567
#define _RWSTD_STREAMOFF
Definition _defs.h:761
#define _RWSTD_STREAMSIZE
Definition _defs.h:762
#define _RWSTD_ASSERT(ignore)
Definition _defs.h:1108
#define _RWSTD_IOS_BASEOFF
Definition _defs.h:805
#define _RWSTD_STATIC_CONST(type, init)
Definition _defs.h:989
Definition json.h:5363