blob: 0ccee9a93ce3423eaccb02dbf4f0c951940615e4 (
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
|
/**
* @file stream_util.h
* C++ stream utility
*
* @remark Copyright 2003 OProfile authors
* @remark Read the file COPYING
*
* @author Philippe Elie
* @author John Levon
*/
#ifndef STREAM_UTIL_H
#define STREAM_UTIL_H
#include <iostream>
/// class which save a stream state and restore it at dtor time
class io_state {
public:
/**
* save the stream flags, precision and fill char.
*
* width is restored at end of expression, there is no need to save it.
* tie and locale are not saved currently
*
* error state shouldn't be saved.
*/
io_state(std::ios & stream);
/// restore the stream state
~io_state();
private:
std::ios & stream;
std::ios::fmtflags format;
std::streamsize precision;
char fill;
};
#endif /* !STREAM_UTIL_H */
|