00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SBUILD_NOSTREAM_H
00020 #define SBUILD_NOSTREAM_H
00021
00022 #include <streambuf>
00023 #include <ostream>
00024
00025 namespace sbuild
00026 {
00027
00032 template <class cT, class traits = std::char_traits<cT> >
00033 class basic_nbuf: public std::basic_streambuf<cT, traits>
00034 {
00041 typename traits::int_type
00042 overflow (typename traits::int_type c)
00043 {
00044 return traits::not_eof(c);
00045 }
00046 };
00047
00052 template <class cT, class traits = std::char_traits<cT> >
00053 class basic_nostream: public std::basic_ostream<cT, traits>
00054 {
00055 public:
00057 basic_nostream ():
00058 std::basic_ios<cT, traits>(&nbuf),
00059 std::basic_ostream<cT, traits>(&nbuf)
00060 {
00061 init(&nbuf);
00062 }
00063
00064 private:
00066 basic_nbuf<cT, traits> nbuf;
00067 };
00068
00070 typedef basic_nostream<char> nostream;
00072 typedef basic_nostream<wchar_t> wnostream;
00073
00075 extern nostream cnull;
00076
00077 }
00078
00079 #endif
00080
00081
00082
00083
00084
00085