HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SYS_StreamUtil.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SYS_StreamUtil.h (SYS Library, C++)
7  *
8  * COMMENTS: Utilities for dealing streams
9  */
10 
11 #ifndef __SYS_STREAMUTIL_H_INCLUDED__
12 #define __SYS_STREAMUTIL_H_INCLUDED__
13 
14 #include "SYS_API.h"
15 #include <iostream>
16 
17 /// SYS_AutoPrecision allows one to temporarily change a stream's precision
18 /// for the life of this object.
20 {
21 public:
22  explicit SYS_AutoPrecision(std::ostream &os, int new_precision)
23  : myStream(os)
24  , myOldPrecision(os.precision(new_precision))
25  {
26  }
28  {
29  (void) myStream.precision(myOldPrecision); // restore
30  }
31 
32 private:
33  std::ostream & myStream;
34  std::streamsize myOldPrecision;
35 };
36 
37 #endif // __SYS_STREAMUTIL_H_INCLUDED__
void
Definition: png.h:1083
SYS_AutoPrecision(std::ostream &os, int new_precision)
GLenum GLint GLint * precision
Definition: glcorearb.h:1925
#define SYS_API
Definition: SYS_API.h:11