From 87774d8981ae7a079492d8949e205065ba72a8e4 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Thu, 16 Mar 2017 23:28:09 +0100 Subject: Add basic console monitor and implement monitor support --- src/ios_save.hh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/ios_save.hh (limited to 'src/ios_save.hh') 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 + +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 -- cgit v1.2.3-70-g09d2