|
Sierra Toolkit
Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* Copyright 2010 Sandia Corporation. */ 00003 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */ 00004 /* license for use of this work by or on behalf of the U.S. Government. */ 00005 /* Export of this program may require a license from the */ 00006 /* United States Government. */ 00007 /*------------------------------------------------------------------------*/ 00008 00009 #ifndef STK_UTIL_DIAG_MANIP_HPP 00010 #define STK_UTIL_DIAG_MANIP_HPP 00011 00012 #include <iomanip> 00013 00014 #include <stk_util/diag/Writer_fwd.hpp> 00015 #include <stk_util/diag/Writer.hpp> 00016 00017 namespace stk_classic { 00018 namespace diag { 00019 00024 00029 struct _setw 00030 { 00031 _setw(int width) 00032 : m_width(width) 00033 {} 00034 00035 int m_width; 00036 }; 00037 00044 inline _setw setw(int width) { 00045 return _setw(width); 00046 } 00047 00048 Writer &operator<<(Writer &dout, _setw set_width); 00049 00050 00055 struct _setprecision 00056 { 00057 _setprecision(int precision) 00058 : m_precision(precision) 00059 {} 00060 00061 int m_precision; 00062 }; 00063 00070 inline _setprecision setprecision(int precision) { 00071 return _setprecision(precision); 00072 } 00073 00074 Writer &operator<<(Writer &dout, _setprecision set_precision); 00075 00076 00081 struct _setfill 00082 { 00083 _setfill(char fill) 00084 : m_fill(fill) 00085 {} 00086 00087 char m_fill; 00088 }; 00089 00096 inline _setfill setfill(char fill) { 00097 return _setfill(fill); 00098 } 00099 00100 Writer &operator<<(Writer &dout, _setfill set_fill); 00101 00102 00107 struct _setiosflags 00108 { 00109 _setiosflags(std::ios_base::fmtflags flags) 00110 : m_flags(flags) 00111 {} 00112 00113 std::ios_base::fmtflags m_flags; 00114 }; 00115 00122 inline _setiosflags setiosflags(std::ios_base::fmtflags flags) { 00123 return _setiosflags(flags); 00124 } 00125 00126 Writer &operator<<(Writer &dout, _setiosflags set_flags); 00127 00128 00133 struct _resetiosflags 00134 { 00135 _resetiosflags(std::ios_base::fmtflags flags) 00136 : m_flags(flags) 00137 {} 00138 00139 std::ios_base::fmtflags m_flags; 00140 }; 00141 00148 inline _resetiosflags resetiosflags(std::ios_base::fmtflags flags) { 00149 return _resetiosflags(flags); 00150 } 00151 00152 Writer &operator<<(Writer &dout, _resetiosflags reset_flags); 00153 00154 Writer &fixed(Writer &dout); 00155 Writer &scientific(Writer &dout); 00156 Writer &dec(Writer &dout); 00157 Writer &hex(Writer &dout); 00158 Writer &oct(Writer &dout); 00159 00163 00164 } // namespace diag 00165 } // namespace stk_classic 00166 00167 namespace sierra { 00168 namespace Diag { 00169 00170 using stk_classic::diag::setw; 00171 using stk_classic::diag::setfill; 00172 using stk_classic::diag::setprecision; 00173 00174 } // namespace Diag 00175 } // namespace sierra 00176 00177 #endif // STK_UTIL_DIAG_MANIP_HPP