/usr/include/wx-2.6/wx/debugrpt.h is in wx2.6-headers 2.6.3.2.2-5ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/debugrpt.h
// Purpose: declaration of wxDebugReport class
// Author: Vadim Zeitlin
// Created: 2005-01-17
// RCS-ID: $Id: debugrpt.h,v 1.7 2005/04/16 21:42:16 RN Exp $
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DEBUGRPT_H_
#define _WX_DEBUGRPT_H_
#include "wx/defs.h"
#if wxUSE_DEBUGREPORT && wxUSE_XML
class WXDLLIMPEXP_XML wxXmlNode;
// ----------------------------------------------------------------------------
// wxDebugReport: generate a debug report, processing is done in derived class
// ----------------------------------------------------------------------------
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_Current, Context_Exception };
// ctor creates a temporary directory where we create the files which will
// be included in the report, use IsOk() to check for errors
wxDebugReport();
// dtor normally destroys the temporary directory created in the ctor (with
// all the files it contains), call Reset() to prevent this from happening
virtual ~wxDebugReport();
// return the name of the directory used for this report
const wxString& GetDirectory() const { return m_dir; }
// return true if the object was successfully initialized
bool IsOk() const { return !GetDirectory().empty(); }
// reset the directory name we use, the object can't be used any more after
// this as it becomes invalid/uninitialized
void Reset() { m_dir.clear(); }
// 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& 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_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_Current); }
bool AddExceptionDump() { return AddDump(Context_Exception); }
virtual bool AddDump(Context ctx);
#endif // wxUSE_CRASHREPORT
// add all available information to the report
void AddAll(Context context = Context_Exception);
// process this report: the base class simply notifies the user that the
// report has been generated, this is usually not enough -- instead you
// should override this method to do something more useful to you
bool Process();
// get the name used as base name for various files, by default
// wxApp::GetName()
virtual wxString GetReportName() const;
// get the files in this report
size_t GetFilesCount() const { return m_files.GetCount(); }
bool GetFile(size_t n, wxString *name, wxString *desc) const;
// remove the file from report: this is used by wxDebugReportPreview to
// allow the user to remove files potentially containing private
// information from the report
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();
private:
// name of the report directory
wxString m_dir;
// the arrays of files in this report and their descriptions
wxArrayString m_files,
m_descriptions;
};
#if wxUSE_ZIPSTREAM
// ----------------------------------------------------------------------------
// wxDebugReportCompress: compress all files of this debug report in a .ZIP
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_QA wxDebugReportCompress : public wxDebugReport
{
public:
wxDebugReportCompress() { }
// returns the full path of the compressed file (empty if creation failed)
const wxString& GetCompressedFileName() const { return m_zipfile; }
protected:
virtual bool DoProcess();
private:
// full path to the ZIP file we created
wxString m_zipfile;
};
// ----------------------------------------------------------------------------
// wxDebugReportUploader: uploads compressed file using HTTP POST request
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_QA wxDebugReportUpload : public wxDebugReportCompress
{
public:
// this class will upload the compressed file created by its base class to
// an HTML multipart/form-data form at the specified address
//
// the URL is the base address, input is the name of the "type=file"
// control on the form used for the file name and action is the value of
// the form action field
wxDebugReportUpload(const wxString& url,
const wxString& input,
const wxString& action,
const wxString& curl = _T("curl"));
protected:
virtual bool DoProcess();
// this function may be overridden in a derived class to show the output
// from curl: this may be an HTML page or anything else that the server
// returned
//
// return value becomes the return value of Process()
virtual bool OnServerReply(const wxArrayString& WXUNUSED(reply))
{
return true;
}
private:
// the full URL to use with HTTP POST request
wxString m_uploadURL;
// the name of the input field containing the file name in the form at
// above URL
wxString m_inputField;
// the curl command (by default it is just "curl" but could be full path to
// curl or a wrapper script with curl-compatible syntax)
wxString m_curlCmd;
};
#endif // wxUSE_ZIPSTREAM
// ----------------------------------------------------------------------------
// wxDebugReportPreview: presents the debug report to the user and allows him
// to veto report entirely or remove some parts of it
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_QA wxDebugReportPreview
{
public:
// ctor is trivial
wxDebugReportPreview() { }
// present the report to the user and allow him to modify it by removing
// some or all of the files and, potentially, adding some notes
//
// return true if the report should be processed or false if the user chose
// to cancel report generation or removed all files from it
virtual bool Show(wxDebugReport& dbgrpt) const = 0;
// dtor is trivial as well but should be virtual for a base class
virtual ~wxDebugReportPreview() { }
};
#if wxUSE_GUI
// ----------------------------------------------------------------------------
// wxDebugReportPreviewStd: standard debug report preview window
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_QA wxDebugReportPreviewStd : public wxDebugReportPreview
{
public:
wxDebugReportPreviewStd() { }
virtual bool Show(wxDebugReport& dbgrpt) const;
};
#endif // wxUSE_GUI
#endif // wxUSE_DEBUGREPORT
#endif // _WX_DEBUGRPT_H_
|