Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenfull_streambuf.h
Go to the documentation of this file.
00001 #ifndef _FULL_STREAM_H 00002 #define _FULL_STREAM_H 00003 00004 #include <streambuf> 00005 00006 /* 00007 * This full_streambuf purpose is to act like a full disk to check the right behavior 00008 * of the STLport code in such a case. 00009 */ 00010 00011 class full_streambuf : public std::streambuf { 00012 public: 00013 typedef std::streambuf _Base; 00014 00015 typedef _Base::int_type int_type; 00016 typedef _Base::traits_type traits_type; 00017 00018 full_streambuf(size_t nb_output, bool do_throw = false) 00019 : _nb_output(nb_output), _do_throw(do_throw) 00020 {} 00021 00022 std::string const& str() const 00023 { return _buf; } 00024 00025 protected: 00026 int_type overflow(int_type c) { 00027 if (_nb_output == 0) { 00028 #if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) 00029 if (_do_throw) { 00030 throw "streambuf full"; 00031 } 00032 #endif 00033 return traits_type::eof(); 00034 } 00035 --_nb_output; 00036 _buf += traits_type::to_char_type(c); 00037 return c; 00038 } 00039 00040 private: 00041 size_t _nb_output; 00042 bool _do_throw; 00043 std::string _buf; 00044 }; 00045 00046 #endif //_FULL_STREAM_H Generated on Sat May 26 2012 04:34:16 for ReactOS by
1.7.6.1
|