ReactOS  0.4.15-dev-1377-ga59cecd
full_streambuf.h
Go to the documentation of this file.
1 #ifndef _FULL_STREAM_H
2 #define _FULL_STREAM_H
3 
4 #include <streambuf>
5 
6 /*
7  * This full_streambuf purpose is to act like a full disk to check the right behavior
8  * of the STLport code in such a case.
9  */
10 
12 public:
14 
15  typedef _Base::int_type int_type;
16  typedef _Base::traits_type traits_type;
17 
18  full_streambuf(size_t nb_output, bool do_throw = false)
19  : _nb_output(nb_output), _do_throw(do_throw)
20  {}
21 
22  std::string const& str() const
23  { return _buf; }
24 
25 protected:
27  if (_nb_output == 0) {
28 #if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
29  if (_do_throw) {
30  throw "streambuf full";
31  }
32 #endif
33  return traits_type::eof();
34  }
35  --_nb_output;
36  _buf += traits_type::to_char_type(c);
37  return c;
38  }
39 
40 private:
41  size_t _nb_output;
42  bool _do_throw;
44 };
45 
46 #endif //_FULL_STREAM_H
int_type overflow(int_type c)
_Base::traits_type traits_type
std::string const & str() const
const GLubyte * c
Definition: glext.h:8905
char string[160]
Definition: util.h:11
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
std::string _buf
#define c
Definition: ke_i.h:80
basic_streambuf< char, char_traits< char > > streambuf
Definition: _iosfwd.h:123
_Base::int_type int_type
std::streambuf _Base
full_streambuf(size_t nb_output, bool do_throw=false)