/[Sims3RigEditor]/trunk/gr2lib_cpp/VSDebugOutput.h
ViewVC logotype

Annotation of /trunk/gr2lib_cpp/VSDebugOutput.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 55 - (hide annotations) (download)
Thu Aug 12 08:37:47 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 1102 byte(s)
Fix all, current, c++ compiler warnings and linker errors

1 william 55 //#pragma once
2 william 10 #ifndef _VS_DEBUG_OUTPUT_H_
3     #define _VS_DEBUG_OUTPUT_H_
4     #include <Windows.h>
5     #include <ostream>
6     #include <sstream>
7     #include <string>
8    
9     template <class CharT, class TraitsT = std::char_traits<CharT> >
10     class VSDebugOutput :
11     public std::basic_stringbuf<CharT, TraitsT>
12     {
13     public:
14    
15     virtual ~VSDebugOutput()
16     {
17     sync();
18     }
19    
20     protected:
21    
22     int sync()
23     {
24     OutputDebugString(str().c_str());
25     str(std::basic_string<CharT>()); // Clear the string buffer
26    
27    
28     return 0;
29     }
30    
31     void OutputDebugString(const CharT *text);
32     };
33    
34     template<class CharT, class TraitsT = std::char_traits<CharT> >
35     class VSDebugOutputWriter :
36     public std::basic_ostream<CharT, TraitsT>
37     {
38     public:
39    
40     VSDebugOutputWriter() : std::basic_ostream<CharT, TraitsT>
41     (new VSDebugOutput<CharT, TraitsT>()) {}
42     ~VSDebugOutputWriter()
43     {
44     delete rdbuf();
45     }
46     };
47     typedef VSDebugOutputWriter<char> VSDebugWriterA;
48     typedef VSDebugOutputWriter<wchar_t> VSDebugWriterW;
49     #endif /* _VS_DEBUG_OUTPUT_H_ */

  ViewVC Help
Powered by ViewVC 1.1.22