X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce4fd7b577cdeb1ceb085cb1380c0df97b6ceef4..7344108e8a129a3f9b4df5ab0f98a1713db03b89:/include/wx/debugrpt.h diff --git a/include/wx/debugrpt.h b/include/wx/debugrpt.h index b193fc550f..c57b27e458 100644 --- a/include/wx/debugrpt.h +++ b/include/wx/debugrpt.h @@ -13,20 +13,23 @@ #include "wx/defs.h" -#if wxUSE_DEBUGREPORT +#if wxUSE_DEBUGREPORT && wxUSE_XML -class WXDLLIMPEXP_XML wxXmlNode; +#include "wx/string.h" +#include "wx/arrstr.h" + +class WXDLLIMPEXP_FWD_XML wxXmlNode; // ---------------------------------------------------------------------------- // wxDebugReport: generate a debug report, processing is done in derived class // ---------------------------------------------------------------------------- -class wxDebugReport +class WXDLLIMPEXP_QA wxDebugReport { public: // this is used for the functions which may report either the current state // or the state during the last (fatal) exception - enum Context { Context_Curent, Context_Exception }; + enum Context { Context_Current, Context_Exception }; // ctor creates a temporary directory where we create the files which will @@ -48,21 +51,31 @@ public: void Reset() { m_dir.clear(); } - // add another file to the report: the file must already exist, its name is - // relative to GetDirectory() + // add another file to the report: the file must already exist, its name + // can be either absolute in which case it is copied to the debug report + // directory or relative to GetDirectory() // // description is shown to the user in the report summary - virtual void AddFile(const wxString& name, const wxString& description); + virtual void AddFile(const wxString& filename, const wxString& description); + + // convenience function: write the given text to a file with the given name + // and then add it to the report (the difference with AddFile() is that the + // file will be created by this function and doesn't have to already exist) + bool AddText(const wxString& filename, + const wxString& text, + const wxString& description); +#if wxUSE_STACKWALKER // add an XML file containing the current or exception context and the // stack trace - bool AddCurrentContext() { return AddContext(Context_Curent); } + bool AddCurrentContext() { return AddContext(Context_Current); } bool AddExceptionContext() { return AddContext(Context_Exception); } virtual bool AddContext(Context ctx); +#endif #if wxUSE_CRASHREPORT // add a file with crash report - bool AddCurrentDump() { return AddDump(Context_Curent); } + bool AddCurrentDump() { return AddDump(Context_Current); } bool AddExceptionDump() { return AddDump(Context_Exception); } virtual bool AddDump(Context ctx); #endif // wxUSE_CRASHREPORT @@ -90,11 +103,13 @@ public: void RemoveFile(const wxString& name); protected: +#if wxUSE_STACKWALKER // used by AddContext() virtual bool DoAddSystemInfo(wxXmlNode *nodeSystemInfo); virtual bool DoAddLoadedModules(wxXmlNode *nodeModules); virtual bool DoAddExceptionInfo(wxXmlNode *nodeContext); virtual void DoAddCustomContext(wxXmlNode * WXUNUSED(nodeRoot)) { } +#endif // used by Process() virtual bool DoProcess(); @@ -114,11 +129,20 @@ private: // wxDebugReportCompress: compress all files of this debug report in a .ZIP // ---------------------------------------------------------------------------- -class wxDebugReportCompress : public wxDebugReport +class WXDLLIMPEXP_QA wxDebugReportCompress : public wxDebugReport { public: wxDebugReportCompress() { } + // you can optionally specify the directory and/or name of the file where + // the debug report should be generated, a default location under the + // directory containing temporary files will be used if you don't + // + // both of these functions should be called before Process()ing the report + // if they're called at all + void SetCompressedFileDirectory(const wxString& dir); + void SetCompressedFileBaseName(const wxString& name); + // returns the full path of the compressed file (empty if creation failed) const wxString& GetCompressedFileName() const { return m_zipfile; } @@ -126,6 +150,10 @@ protected: virtual bool DoProcess(); private: + // user-specified file directory/base name, use defaults if empty + wxString m_zipDir, + m_zipName; + // full path to the ZIP file we created wxString m_zipfile; }; @@ -134,7 +162,7 @@ private: // wxDebugReportUploader: uploads compressed file using HTTP POST request // ---------------------------------------------------------------------------- -class wxDebugReportUpload : public wxDebugReportCompress +class WXDLLIMPEXP_QA wxDebugReportUpload : public wxDebugReportCompress { public: // this class will upload the compressed file created by its base class to @@ -146,7 +174,7 @@ public: wxDebugReportUpload(const wxString& url, const wxString& input, const wxString& action, - const wxString& curl = _T("curl")); + const wxString& curl = wxT("curl")); protected: virtual bool DoProcess(); @@ -182,7 +210,7 @@ private: // to veto report entirely or remove some parts of it // ---------------------------------------------------------------------------- -class wxDebugReportPreview +class WXDLLIMPEXP_QA wxDebugReportPreview { public: // ctor is trivial @@ -205,7 +233,7 @@ public: // wxDebugReportPreviewStd: standard debug report preview window // ---------------------------------------------------------------------------- -class wxDebugReportPreviewStd : public wxDebugReportPreview +class WXDLLIMPEXP_QA wxDebugReportPreviewStd : public wxDebugReportPreview { public: wxDebugReportPreviewStd() { } @@ -215,7 +243,6 @@ public: #endif // wxUSE_GUI -#endif // wxUSE_DEBUGREPORT +#endif // wxUSE_DEBUGREPORT && wxUSE_XML #endif // _WX_DEBUGRPT_H_ -