#ifndef __JLANG__JNULLSTREAMBUFFER__ #define __JLANG__JNULLSTREAMBUFFER__ #include #include /** * \author mdejong */ namespace JLANG {} namespace JPP { using namespace JLANG; } namespace JLANG { /** * Null stream buffer. */ class JNullStreamBuffer : public virtual std::streambuf { public: typedef std::streambuf::traits_type traits; typedef traits::int_type int_type; typedef std::streamsize streamsize; /** * Default constructor. */ JNullStreamBuffer() {} /** * Get reference to unique instance of this class object. * * \return reference to this class object */ static const JNullStreamBuffer& getInstance() { static const JNullStreamBuffer null; return null; } /** * Check underflow. * This method reads nothing. * * \return 0 */ virtual int_type underflow() { return EOF; } /** * Check overflow. * This method writes nothing. * * \param c character * \return c */ virtual int_type overflow(int_type c) { return c; } }; } #endif