Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginDebug.h

Issue 5750789393874944: [IE] First round of ATL removal (Closed)
Patch Set: Created June 20, 2014, 9:22 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #ifndef _PLUGIN_DEBUG_H_ 1 #ifndef _PLUGIN_DEBUG_H_
2 #define _PLUGIN_DEBUG_H_ 2 #define _PLUGIN_DEBUG_H_
3 3
4 4
5 class CPluginDebug 5 class CPluginDebug
6 { 6 {
7 7
8 public: 8 public:
9 9
10 #if (defined ENABLE_DEBUG_INFO) 10 #if (defined ENABLE_DEBUG_INFO)
11 static void Debug(const CString& error, DWORD dwProcessId=0, DWORD dwThreadId= 0); 11 static void Debug(const std::wstring &, DWORD dwProcessId=0, DWORD dwThreadId= 0);
12 inline static void Debug(const wchar_t line[], DWORD dwProcessId=0, DWORD dwTh readId=0)
13 {
14 CPluginDebug::Debug( std::wstring( line ), dwProcessId, dwThreadId );
15 }
16 static void Debug(const std::wstring[], size_t, DWORD dwProcessId=0, DWORD dwT hreadId=0);
17 template< size_t n_lines >
18 inline static void Debug(const std::wstring (&lines)[n_lines])
19 {
20 CPluginDebug::Debug( lines, n_lines, 0, 0 );
21 }
12 static void DebugClear(); 22 static void DebugClear();
13 static void DebugError(const CString& error); 23
14 static void DebugErrorCode(DWORD errorCode, const CString& error, DWORD dwProc essId=0, DWORD dwThreadId=0); 24 /*
25 * About the only reason we need narrow strings is to deal with std::exception ::what().
26 */
27 static void DebugError(std::string error);
28 static void DebugErrorCode(DWORD errorCode, const std::wstring & error, DWORD dwProcessId=0, DWORD dwThreadId=0);
15 #endif 29 #endif
16 30
17 #if (defined ENABLE_DEBUG_RESULT) 31 #if (defined ENABLE_DEBUG_RESULT)
18 static void DebugResult(const CString& text); 32 static void DebugResult(const std::wstring & text);
19 static void DebugResultDomain(const CString& domain); 33 static void DebugResultDomain(const std::wstring & domain);
20 static void DebugResultBlocking(const CString& type, const CString& src, const CString& domain); 34 static void DebugResultBlocking(const std::wstring & type, const std::wstring & src, const std::wstring & domain);
21 static void DebugResultHiding(const CString& tag, const CString& id, const CSt ring& filter); 35 static void DebugResultHiding(const std::wstring & tag, const std::wstring & i d, const std::wstring & filter);
22 static void DebugResultClear(); 36 static void DebugResultClear();
23 #endif 37 #endif
24 38
25 #if (defined ENABLE_DEBUG_RESULT_IGNORED) 39 #if (defined ENABLE_DEBUG_RESULT_IGNORED)
26 static void DebugResultIgnoring(const CString& type, const CString& src, const CString& domain); 40 static void DebugResultIgnoring(const std::wstring & type, const std::wstring & src, const std::wstring & domain);
27 #endif 41 #endif
28 }; 42 };
29 43
44 namespace ABP
45 {
46 namespace debug
47 {
48 /**
49 * Widen a narrow-character string to a wide-character one.
50 *
51 * This method assumes that the original string is plain ASCII, with no mult ibyte sequences (such as UTF-8).
52 *
53 * The only reason this function is here is to deal with std::exception::wha t(), which uses narrow characters.
54 * Therefore this function is in the 'debug' namespace, since these exceptio n texts are for developer use only.
55 */
56 std::wstring widen( std::string );
57
58 /**
59 * Narrow a wide-character string to a narrow-character one.
60 */
61 std::string narrow( std::wstring );
62
63 /**
64 * Truncate a source string to a maximum of 100 characters.
65 */
66 void truncate_source( std::wstring & src );
67 }
68 }
30 69
31 #endif // _PLUGIN_DEBUG_H_ 70 #endif // _PLUGIN_DEBUG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld