fmt_guard.hpp

Go to the documentation of this file.
00001 #ifndef IOF_FMT_GUARD_HPP_
00002 #define IOF_FMT_GUARD_HPP_
00003 
00016 #include "iof/fmt_spec.hpp"
00017 
00018 
00019 namespace iof 
00020 {
00021     
00022 
00027 class fmt_guard
00028 {
00029     public:
00030         fmt_guard(std::ios& strm): my_fmt(strm), my_strm(strm) {}
00031         
00032         template <typename Stream>
00033         fmt_guard(Stream& strm, const fmt_spec& newFmt)
00034             : my_fmt(strm), my_strm(strm) {strm << newFmt;}
00035             
00036         template <typename Stream>
00037         fmt_guard(Stream& strm, const char* newFmt)
00038             : my_fmt(strm), my_strm(strm) {strm << fmt_spec(newFmt);}
00039             
00040        ~fmt_guard() { my_fmt.applyTo(my_strm); }
00041        
00042     private:
00043         const stream_fmt my_fmt;
00044         std::ios&        my_strm;
00045 };
00046 
00047 } // namespace iof
00048 
00049 #endif // IOF_FMT_GUARD_HPP_

Generated on Fri Nov 24 16:16:01 2006 for IOF Library by doxygen 1.5.1-p1
Thanks to SourceForge.net Logo for hosting