ROSE
0.11.145.192
src
Rose
FormatRestorer.h
1
#ifndef ROSE_FormatRestorer_H
2
#define ROSE_FormatRestorer_H
3
#include <RoseFirst.h>
4
5
#include <iostream>
6
53
class
FormatRestorer
{
54
protected
:
55
std::ostream &stream;
56
std::ios_base::fmtflags fmt;
57
58
public
:
60
FormatRestorer
(std::ostream &o): stream(o) {
61
save
(o);
62
}
63
65
~FormatRestorer
() {
66
restore
();
67
}
68
70
void
save
(std::ostream &o) {
71
fmt = o.flags();
72
}
73
75
void
restore
() {
76
stream.flags(fmt);
77
}
78
};
79
80
#endif
FormatRestorer
Restores output stream flags to original values.
Definition
FormatRestorer.h:53
FormatRestorer::restore
void restore()
Restore saved flags.
Definition
FormatRestorer.h:75
FormatRestorer::~FormatRestorer
~FormatRestorer()
Destructor restores output stream flags.
Definition
FormatRestorer.h:65
FormatRestorer::save
void save(std::ostream &o)
Save current output stream flags.
Definition
FormatRestorer.h:70
FormatRestorer::FormatRestorer
FormatRestorer(std::ostream &o)
Constructor saves output stream flags.
Definition
FormatRestorer.h:60
Generated on Mon Dec 16 2024 03:17:00 for ROSE by
1.9.8