Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
ios-savepoint.hpp
Go to the documentation of this file.
1/*
2 IOS-SAVEPOINT.hpp - capture and restore std::ostream format settings
3
4 Copyright (C)
5 2022, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
34#ifndef LIB_IOS_SAVEPOINT_H
35#define LIB_IOS_SAVEPOINT_H
36
37#include "lib/nocopy.hpp"
38
39#include <ostream>
40
41
42
43namespace util {
44
50 : MoveOnly
51 {
52 std::ostream& theStream_;
53 std::ios_base::fmtflags prevFlags_;
55
56 public:
57 explicit
58 IosSavepoint(std::ostream& stream_to_capture)
59 : theStream_{stream_to_capture}
60 , prevFlags_{theStream_.flags()}
61 , fillChar_{theStream_.fill()}
62 { }
63
65 {
68 }
69 };
70
71
72} // namespace util
73#endif /*LIB_IOS_SAVEPOINT_H*/
RAII helper to capture and restore output stream format settings.
std::ios_base::fmtflags prevFlags_
std::ostream & theStream_
IosSavepoint(std::ostream &stream_to_capture)
Types marked with this mix-in may be moved but not copied.
Definition nocopy.hpp:50
Mix-Ins to allow or prohibit various degrees of copying and cloning.