---
 rtemstoolkit/rtems-utils.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/rtemstoolkit/rtems-utils.h b/rtemstoolkit/rtems-utils.h
index 4ce9c68..c4a262e 100644
--- a/rtemstoolkit/rtems-utils.h
+++ b/rtemstoolkit/rtems-utils.h
@@ -47,6 +47,24 @@ namespace rtems
                bool        real = false,
                size_t      line_length = 16,
                uint32_t    offset = 0);
+
+    /*
+     * Save and restore the output stream's settings.
+     */
+    struct ostream_guard {
+      std::ostream&           o;
+      std::ios_base::fmtflags flags;
+
+      ostream_guard ( std::ostream& o_ ) : o( o_ ), flags( o_.flags() )
+      {
+      }
+
+      ~ostream_guard ()
+      {
+          o.flags( flags );
+      }
+    };
+
   }
 }
 
-- 
1.8.3.1

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to