00001 00002 // Name: wxGuiTest/ProvokedWarningRegistry.h 00003 // Author: Reinhold Fuereder 00004 // Created: 2004 00005 // Copyright: (c) 2005 Reinhold Fuereder 00006 // Modifications: John Ralls, 2007-2008 00007 // Modifications Copyright: (c) 2008 John Ralls 00008 // Licence: wxWindows licence 00009 // 00010 // $Id$ 00012 00013 #ifndef PROVOKEDWARNINGREGISTRY_H 00014 #define PROVOKEDWARNINGREGISTRY_H 00015 00016 #ifdef __GNUG__ 00017 #pragma interface "ProvokedWarningRegistry.h" 00018 #endif 00019 00020 #include <wxGuiTest/Common.h> 00021 00022 #include <map> 00023 00024 #include <wxGuiTest/ProvokedWarning.h> 00025 00026 namespace wxTst { 00027 00028 00035 class ProvokedWarningRegistry 00036 { 00037 public: 00043 static ProvokedWarningRegistry & GetInstance (); 00044 00045 00049 static void Destroy (); 00050 00051 00057 virtual void RegisterWarning (const ProvokedWarning &warning); 00058 00059 00065 virtual void UnregisterWarning (const ProvokedWarning &warning); 00066 00067 00075 virtual bool IsRegisteredAndInTime (const ProvokedWarning &warning) const; 00076 00077 00084 virtual bool WasDetected (const ProvokedWarning &warning) const; 00085 00086 00092 virtual void SetWarningAsDetected (const ProvokedWarning &warning); 00093 00094 00103 virtual const ProvokedWarning* FindRegisteredWarning ( 00104 const wxString &caption, const wxString &message = _T("")) const; 00105 00106 protected: 00110 ProvokedWarningRegistry (); 00111 00112 00116 virtual ~ProvokedWarningRegistry (); 00117 00118 private: 00119 static ProvokedWarningRegistry *ms_instance; 00120 // Key is provoked/expected warning, value if it was detected: 00121 typedef std::map< const ProvokedWarning *, bool > ProvokedWarningMap; 00122 ProvokedWarningMap warnings; 00123 00124 private: 00125 // No copy and assignment constructor: 00126 ProvokedWarningRegistry (const ProvokedWarningRegistry &rhs); 00127 ProvokedWarningRegistry & operator= (const ProvokedWarningRegistry &rhs); 00128 }; 00129 00130 } // End namespace wxTst 00131 00132 #endif // PROVOKEDWARNINGREGISTRY_H 00133