3 /* http://vision.kuee.kyoto-u.ac.jp/~nob/doc/win32/win32.html#doc1_42
\r
8 #ifndef STDX_DSTREAM_H
\r
10 #define STDX_DSTREAM_H
\r
17 // VC++
\82Å STLport
\82¾
\82Æ using std::char_traits;
\82Ý
\82½
\82¢
\82È
\82Ì
\82ª
\95K
\97v
\82©
\82à
\r
18 template <typename Ch_T, typename Tr_T = std::char_traits<Ch_T> >
\r
19 class basic_dbg_streambuf: public std::basic_stringbuf<Ch_T, Tr_T>
\r
22 basic_dbg_streambuf()
\r
24 #ifndef STDX_DSTREAM_BUFFERING
\r
29 virtual ~basic_dbg_streambuf()
\r
37 dbg_out(str().c_str());
\r
38 pbump(static_cast<int>(pbase() - pptr()));
\r
42 void dbg_out(const Ch_T*);
\r
46 inline void basic_dbg_streambuf<char>::dbg_out(const char *str)
\r
48 ::OutputDebugStringA(str);
\r
52 inline void basic_dbg_streambuf<wchar_t>::dbg_out(const wchar_t *str)
\r
54 ::OutputDebugStringW(str);
\r
57 template <typename Ch_T, typename Tr_T = std::char_traits<Ch_T> >
\r
58 class basic_dbg_ostream: public std::basic_ostream<Ch_T, Tr_T>
\r
61 basic_dbg_ostream() : std::basic_ostream<Ch_T, Tr_T>(new basic_dbg_streambuf<Ch_T, Tr_T>())
\r
65 virtual ~basic_dbg_ostream()
\r
67 // flush(); //
\95s
\97v
\82ç
\82µ
\82¢
\81Dhttp://www.tietew.jp/cppll/archive/607
\r
72 typedef basic_dbg_streambuf<wchar_t> wdbg_streambuf;
\r
73 typedef basic_dbg_ostream<wchar_t> wdstream;
\r
75 //
\82±
\82ê
\82ð
\92è
\8b`
\82µ
\82Ä
\82¨
\82
\82Æ
\81C dout
\82Ì
\90é
\8c¾
\82ª
\82¢
\82ç
\82È
\82
\82È
\82é
\81D
\r
77 static wdstream wdout;
\r
78 #define DOUT(x) wdout << x
\r
83 // struct dummy_wdout {
\r
84 // //template <typename R>
\r
85 // //inline dummy_wdout& operator<<(const R v) {return *this;};
\r
87 // //template <typename R>
\r
88 // //inline dummy_wdout& operator<<(const R* v) {return *this;};
\r
90 // //template <typename R>
\r
91 // //inline dummy_wdout& operator<<(const R& v) {return *this;};
\r
93 // //template <typename R>
\r
94 // //inline dummy_wdout& operator<<(const R&& v) {return *this;};
\r
96 // ////template <typename R,int N>
\r
97 // ////inline dummy_wdout& operator<<(const R(&a)[N]) {return *this;};
\r
101 // static dummy_wdout wdout;
\r
104 //template <typename L>
\r
105 //inline sf::dummy_wdout& operator<<(sf::dummy_wdout& p,const L v) {return p;};
\r
107 //template <typename L>
\r
108 //inline sf::dummy_wdout& operator<<(sf::dummy_wdout& p,const L& v) {return p;};
\r
110 //template <typename L>
\r
111 //inline sf::dummy_wdout& operator<<(sf::dummy_wdout& p,const L&& v) {return p;};
\r
113 ////template <typename L>
\r
114 ////inline sf::dummy_wdout& operator<<(sf::dummy_wdout& p,const L* v) {return p;};
\r
116 //template <typename L,int N>
\r
117 //inline sf::dummy_wdout& operator<<(sf::dummy_wdout& p,const L(&a)[N]) {return p;};
\r
119 //template <typename L>
\r
120 //inline L& operator<<(const L v,sf::dummy_wdout& p) {return v;};
\r
122 //template <typename L>
\r
123 //inline L& operator<<(sf::dummy_wdout& p,L v) {return v;};
\r
126 //template <typename L>
\r
127 //inline sf::dummy_wdout& operator<<(const L v,sf::dummy_wdout& p) {return p;};
\r
129 //template <typename L>
\r
130 //inline sf::dummy_wdout& operator<<(const L& v,sf::dummy_wdout& p) {return p;};
\r
132 ////template <typename L>
\r
133 ////inline sf::dummy_wdout& operator<<(const L* v,sf::dummy_wdout& p) {return p;};
\r
135 //template <typename L>
\r
136 //inline sf::dummy_wdout& operator<<(const L&& v,sf::dummy_wdout& p) {return p;};
\r
139 //template <typename L,int N>
\r
140 //inline sf::dummy_wdout& operator<<(const L(&a)[N],sf::dummy_wdout& p) {return p;};
\r
142 //template <typename L>
\r
143 //inline sf::dummy_wdout& operator<<(sf::dummy_wdout& p , const L *v) {return p;};
\r
148 #endif // STDX_DSTREAM_