Sierra Toolkit Version of the Day
WriterManip.cpp
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 #include <stk_util/diag/WriterManip.hpp>
00010 
00011 namespace stk {
00012 namespace diag {
00013 
00014 Writer &operator<<(Writer &dout, _setw set_width) {
00015   if (dout.shouldPrint())
00016     dout.getStream().width(set_width.m_width);
00017   return dout;
00018 }
00019 
00020 Writer &
00021 operator<<(Writer &dout, _setprecision set_precision) {
00022   if (dout.shouldPrint())
00023     dout.getStream().precision(set_precision.m_precision);
00024   return dout;
00025 }
00026 
00027 Writer &
00028 operator<<(Writer &dout, _setfill set_fill) {
00029   if (dout.shouldPrint())
00030     dout.getStream().fill(set_fill.m_fill);
00031   return dout;
00032 }
00033 
00034 Writer &
00035 operator<<(Writer &dout, _resetiosflags reset_flags) {
00036   if (dout.shouldPrint())
00037     dout.getStream().setf(std::ios_base::fmtflags(0), reset_flags.m_flags);
00038   return dout;
00039 }
00040 
00041 Writer &
00042 operator<<(Writer &dout, _setiosflags set_flags) {
00043   if (dout.shouldPrint())
00044     dout.getStream().setf(set_flags.m_flags);
00045   return dout;
00046 }
00047 
00048 Writer &
00049 fixed(
00050   Writer &      dout)
00051 {
00052   if (dout.shouldPrint())
00053     dout.getStream().setf(std::ios_base::fixed, std::ios_base::floatfield);
00054   return dout;
00055 }
00056 
00057 Writer &
00058 scientific(
00059   Writer &      dout)
00060 {
00061   if (dout.shouldPrint())
00062     dout.getStream().setf(std::ios_base::scientific, std::ios_base::floatfield);
00063   return dout;
00064 }
00065 
00066 Writer &
00067 dec(
00068   Writer &      dout)
00069 {
00070   if (dout.shouldPrint())
00071     dout.getStream().setf(std::ios_base::dec, std::ios_base::basefield);
00072   return dout;
00073 }
00074 
00075 Writer &
00076 hex(
00077   Writer &      dout)
00078 {
00079   if (dout.shouldPrint())
00080     dout.getStream().setf(std::ios_base::hex, std::ios_base::basefield);
00081   return dout;
00082 }
00083 
00084 Writer &
00085 oct(
00086   Writer &      dout)
00087 {
00088   if (dout.shouldPrint())
00089     dout.getStream().setf(std::ios_base::oct, std::ios_base::basefield);
00090   return dout;
00091 }
00092 
00093 } // namespace diag
00094 } // namespace stk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends