ReactOS 0.4.16-dev-92-g0c2cdca
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
11class full_streambuf : public std::streambuf {
12public:
13 typedef std::streambuf _Base;
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
25protected:
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
40private:
41 size_t _nb_output;
43 std::string _buf;
44};
45
46#endif //_FULL_STREAM_H
_Base::int_type int_type
std::streambuf _Base
std::string const & str() const
_Base::traits_type traits_type
std::string _buf
full_streambuf(size_t nb_output, bool do_throw=false)
int_type overflow(int_type c)
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80