Patrick Lühne
ca7ae883ee
Some of the unit tests depended on Boost’s null_sink to redirect the unwanted test output to /dev/null. This commit adds a simple NullOutputStream as a replacement and removes the obsolete Boost includes.
45 lines
952 B
C++
45 lines
952 B
C++
#ifndef __PLASP__TESTS__NULL_OUTPUT_STREAM_H
|
|
#define __PLASP__TESTS__NULL_OUTPUT_STREAM_H
|
|
|
|
#include <iostream>
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// NullOutputStream
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
class NullStreamBuffer : public std::streambuf
|
|
{
|
|
private:
|
|
char dummyBuffer[64];
|
|
|
|
protected:
|
|
virtual int overflow(int c)
|
|
{
|
|
setp(dummyBuffer, dummyBuffer + sizeof(dummyBuffer));
|
|
return (c == traits_type::eof()) ? '\0' : c;
|
|
}
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
class NullOutputStream : public std::ostream
|
|
{
|
|
public:
|
|
NullOutputStream()
|
|
: std::ostream(&m_nullStreamBuffer)
|
|
{
|
|
}
|
|
|
|
NullStreamBuffer *rdbuf() const
|
|
{
|
|
return &m_nullStreamBuffer;
|
|
}
|
|
|
|
private:
|
|
mutable NullStreamBuffer m_nullStreamBuffer;
|
|
};
|
|
|
|
#endif
|