|
Sierra Toolkit
Version of the Day
|
00001 /* ------------------------------------------------------------------ */ 00002 /* Copyright 2000 Sandia Corporation, Albuquerque, NM. */ 00003 /* ------------------------------------------------------------------ */ 00004 00005 #ifndef STK_UTIL_UTIL_null_streambuf_hpp 00006 #define STK_UTIL_UTIL_null_streambuf_hpp 00007 00008 #include <iostream> 00009 #include <cstdio> /* Defines EOF */ 00010 00011 //: Specialize the ANSI Standard C++ streambuf class 00012 //: that throws away everything given to it without 00013 //: generating an error. 00014 00015 class null_streambuf : public std::streambuf { 00016 public: 00017 00018 //: Constructor 00019 null_streambuf(); 00020 00021 //: Destructor 00022 virtual ~null_streambuf(); 00023 00024 protected: 00025 00026 //: Called when output buffer is filled 00027 virtual int overflow( int c = EOF ); 00028 00029 //: Sync is a no-op 00030 virtual int sync(); 00031 00032 //: Setbuf is a no-op 00033 virtual std::streambuf * setbuf( char * s , std::streamsize n ); 00034 00035 private: 00036 00037 null_streambuf( const null_streambuf & ); // Not allowed 00038 null_streambuf & operator = ( const null_streambuf & ); // Not allowed 00039 00040 char buf[64]; // Throw away buffer 00041 }; 00042 00043 /*--------------------------------------------------------------------*/ 00044 00045 #endif // STK_UTIL_UTIL_null_streambuf_hpp