summaryrefslogtreecommitdiff
path: root/src/ios_save.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-03-16 23:28:09 +0100
committerJoel Klinghed <the_jk@yahoo.com>2017-03-16 23:38:19 +0100
commit87774d8981ae7a079492d8949e205065ba72a8e4 (patch)
treef056ffbdfb436143db1d968ffc7c82b1cb3d79a3 /src/ios_save.hh
parent719d90a40e83e870be19f8d46cc55caed618aa35 (diff)
Add basic console monitor and implement monitor support
Diffstat (limited to 'src/ios_save.hh')
-rw-r--r--src/ios_save.hh31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/ios_save.hh b/src/ios_save.hh
new file mode 100644
index 0000000..1abcf53
--- /dev/null
+++ b/src/ios_save.hh
@@ -0,0 +1,31 @@
+// -*- mode: c++; c-basic-offset: 2; -*-
+
+#ifndef IOS_SAVE_HH
+#define IOS_SAVE_HH
+
+#include <ostream>
+
+class ios_save {
+public:
+ ios_save(std::ostream& ostream)
+ : ostream_(ostream), save_(nullptr) {
+ save_.copyfmt(ostream);
+ }
+
+ ios_save(ios_save const& save)
+ : ostream_(save.ostream_), save_(nullptr) {
+ save_.copyfmt(save.save_);
+ }
+
+ ~ios_save() {
+ ostream_.copyfmt(save_);
+ }
+
+ ios_save& operator=(ios_save const&) = delete;
+
+private:
+ std::ostream& ostream_;
+ std::ios save_;
+};
+
+#endif // IOS_SAVE_HH