forked from andrew-d/cpplog
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoutputdebugstream.hpp
More file actions
Latest commit
47 lines (38 loc) · 1 KB
/
Copy pathoutputdebugstream.hpp
File metadata and controls
47 lines (38 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#ifndef _OUTPUT_DEBUG_STREAM_H
#define_OUTPUT_DEBUG_STREAM_H
#include<windows.h>
template <class_Elem>
classoutputdebug_buf: publicstd::basic_stringbuf<_Elem>
{
private:
inlinevoidoutput_debug_string(const _Elem* e);
public:
virtualintsync ( )
{
//outputdebug_buf<_Elem>::output_debug_string(std::basic_stringbuf<_Elem>::str().c_str());
this->output_debug_string(std::basic_stringbuf<_Elem>::str().c_str());
return0;
}
};
template<>
inlinevoid outputdebug_buf<char>::output_debug_string(constchar* e)
{
::OutputDebugStringA(e);
}
template<>
inlinevoid outputdebug_buf<wchar_t>::output_debug_string(constwchar_t* e)
{
::OutputDebugStringW(e);
}
template <class_Elem>
classoutputdebug_stream: publicstd::basic_ostream<_Elem>
{
public:
outputdebug_stream() : std::basic_ostream<_Elem>(new outputdebug_buf<_Elem>())
{}
~outputdebug_stream(){ deletethis->rdbuf(); }
};
typedef outputdebug_stream<char> dbgwin_stream;
typedef outputdebug_stream<wchar_t> wdbgwin_stream;
#endif