2023-11-12 17:30:44 +01:00
|
|
|
#ifndef DYNAMIC_PROGRAM_NULL_BUFFER_H
|
|
|
|
#define DYNAMIC_PROGRAM_NULL_BUFFER_H
|
|
|
|
|
2023-11-15 23:07:39 +01:00
|
|
|
#include <iosfwd>
|
2023-11-12 17:30:44 +01:00
|
|
|
|
2023-11-16 16:20:04 +01:00
|
|
|
namespace NullBuffer
|
|
|
|
{
|
|
|
|
|
|
|
|
class NullBuffer final : public std::streambuf
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int overflow(int c) override
|
|
|
|
{ return c; }
|
|
|
|
};
|
|
|
|
|
2023-11-16 16:29:41 +01:00
|
|
|
/**
|
|
|
|
* A Stream that does nothing on writing to it
|
|
|
|
*/
|
2023-11-16 16:20:04 +01:00
|
|
|
class NullStream final : public std::ostream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NullStream() : std::ostream(&_m_sb)
|
|
|
|
{}
|
|
|
|
|
|
|
|
private:
|
|
|
|
NullBuffer _m_sb;
|
|
|
|
};
|
|
|
|
|
|
|
|
NullStream null_stream;
|
2023-11-12 17:30:44 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif //DYNAMIC_PROGRAM_NULL_BUFFER_H
|