| OLD | NEW | 
|   1 #ifndef _PLUGIN_CLIENT_BASE_H_ |   1 #ifndef _PLUGIN_CLIENT_BASE_H_ | 
|   2 #define _PLUGIN_CLIENT_BASE_H_ |   2 #define _PLUGIN_CLIENT_BASE_H_ | 
|   3  |   3  | 
|   4  |   4  | 
|   5 #include "PluginTypedef.h" |   5 #include "PluginTypedef.h" | 
|   6  |   6  | 
|   7  |   7  | 
|   8 class CPluginClientFactory; |   8 class CPluginClientFactory; | 
|   9  |   9  | 
|  10  |  10  | 
|  11 class CPluginError |  11 class CPluginError | 
|  12 { |  12 { | 
|  13  |  13  | 
|  14 private: |  14 private: | 
|  15  |  15  | 
|  16   int m_errorId; |  16   int m_errorId; | 
|  17   int m_errorSubid; |  17   int m_errorSubid; | 
|  18   DWORD m_errorCode; |  18   DWORD m_errorCode; | 
|  19   CString m_errorDescription; |  19   std::wstring m_errorDescription; | 
|  20   DWORD m_processId; |  20   DWORD m_processId; | 
|  21   DWORD m_threadId; |  21   DWORD m_threadId; | 
|  22  |  22  | 
|  23 public: |  23 public: | 
|  24  |  24  | 
|  25   CPluginError(int errorId, int errorSubid, DWORD errorCode, const CString& erro
    rDesc) :  |  25   CPluginError(int errorId, int errorSubid, DWORD errorCode, const std::wstring 
    & errorDesc) :  | 
|  26     m_errorId(errorId), m_errorSubid(errorSubid), m_errorCode(errorCode), m_erro
    rDescription(errorDesc) |  26     m_errorId(errorId), m_errorSubid(errorSubid), m_errorCode(errorCode), m_erro
    rDescription(errorDesc) | 
|  27   { |  27   { | 
|  28     m_processId = ::GetCurrentProcessId(); |  28     m_processId = ::GetCurrentProcessId(); | 
|  29     m_threadId = ::GetCurrentThreadId(); |  29     m_threadId = ::GetCurrentThreadId(); | 
|  30   } |  30   } | 
|  31  |  31  | 
|  32   CPluginError() :  |  32   CPluginError() :  | 
|  33     m_errorId(0), m_errorSubid(0), m_errorCode(0), m_processId(0), m_threadId(0)
     {} |  33     m_errorId(0), m_errorSubid(0), m_errorCode(0), m_processId(0), m_threadId(0)
     {} | 
|  34  |  34  | 
|  35   CPluginError(const CPluginError& org) :  |  35   CPluginError(const CPluginError& org) :  | 
|  36     m_errorId(org.m_errorId), m_errorSubid(org.m_errorSubid), m_errorCode(org.m_
    errorCode), m_errorDescription(org.m_errorDescription), m_processId(org.m_proces
    sId), m_threadId(org.m_threadId) {} |  36     m_errorId(org.m_errorId), m_errorSubid(org.m_errorSubid), m_errorCode(org.m_
    errorCode), m_errorDescription(org.m_errorDescription), m_processId(org.m_proces
    sId), m_threadId(org.m_threadId) {} | 
|  37  |  37  | 
|  38   int GetErrorId() const { return m_errorId; } |  38   int GetErrorId() const { return m_errorId; } | 
|  39   int GetErrorSubid() const { return m_errorSubid; } |  39   int GetErrorSubid() const { return m_errorSubid; } | 
|  40   DWORD GetErrorCode() const { return m_errorCode; } |  40   DWORD GetErrorCode() const { return m_errorCode; } | 
|  41   CString GetErrorDescription() const { return m_errorDescription; } |  41   std::wstring GetErrorDescription() const { return m_errorDescription; } | 
|  42   DWORD GetProcessId() const { return m_processId; } |  42   DWORD GetProcessId() const { return m_processId; } | 
|  43   DWORD GetThreadId() const { return m_threadId; } |  43   DWORD GetThreadId() const { return m_threadId; } | 
|  44 }; |  44 }; | 
|  45  |  45  | 
|  46  |  46  | 
|  47 class CPluginClientBase |  47 class CPluginClientBase | 
|  48 { |  48 { | 
|  49   friend class CPluginClientFactory; |  49   friend class CPluginClientFactory; | 
|  50  |  50  | 
|  51 private: |  51 private: | 
|  52  |  52  | 
|  53   static std::vector<CPluginError> s_pluginErrors; |  53   static std::vector<CPluginError> s_pluginErrors; | 
|  54  |  54  | 
|  55   static bool s_isErrorLogging; |  55   static bool s_isErrorLogging; | 
|  56  |  56  | 
|  57 protected: |  57 protected: | 
|  58  |  58  | 
|  59   // Protected constructor used by the singleton pattern |  59   // Protected constructor used by the singleton pattern | 
|  60   CPluginClientBase(); |  60   CPluginClientBase(); | 
|  61  |  61  | 
|  62   static CComAutoCriticalSection s_criticalSectionLocal; |  62   static CComAutoCriticalSection s_criticalSectionLocal; | 
|  63  |  63  | 
|  64 public: |  64 public: | 
|  65  |  65  | 
|  66   ~CPluginClientBase(); |  66   ~CPluginClientBase(); | 
|  67  |  67  | 
|  68   static void SetLocalization(); |  68   static void SetLocalization(); | 
|  69  |  69  | 
|  70   static bool IsValidDomain(const CString& domain); |  70   static bool IsValidDomain(const std::wstring & domain); | 
|  71   static CString& UnescapeUrl(CString& url); |  | 
|  72  |  71  | 
|  73   static void LogPluginError(DWORD errorCode, int errorId, int errorSubid, const
     CString& description="", bool isAsync=false, DWORD dwProcessId=0, DWORD dwThrea
    dId=0); |  72   static void LogPluginError(DWORD errorCode, int errorId, int errorSubid, const
     std::wstring & description=L"", bool isAsync=false, DWORD dwProcessId=0, DWORD 
    dwThreadId=0); | 
|  74  |  73  | 
|  75   static void PostPluginError(int errorId, int errorSubid, DWORD errorCode, cons
    t CString& errorDescription); |  74   static void PostPluginError(int errorId, int errorSubid, DWORD errorCode, cons
    t std::wstring & errorDescription); | 
|  76   static bool PopFirstPluginError(CPluginError& pluginError); |  75   static bool PopFirstPluginError(CPluginError& pluginError); | 
|  77 }; |  76 }; | 
|  78  |  77  | 
|  79  |  78  | 
|  80 #endif // _PLUGIN_CLIENT_BASE_H_ |  79 #endif // _PLUGIN_CLIENT_BASE_H_ | 
| OLD | NEW |