Debian Codegraph @

libraries/lib-breakpad-configurer/internal/win32/CrashReportContext.h

raw
1 /*!********************************************************************
2 *
3 Audacity: A Digital Audio Editor
4
5 CrashReportContext.h
6
7 Vitaly Sverchinsky
8
9 **********************************************************************/
10
11 #pragma once
12
13 #include <string>
14 #include <map>
15
16 //!This object is for internal usage.
17 /*! Simple POD type, holds user data required to start handler.
18 * Fields are initialized with Set* methods,
19 * which may return false if internal buffer isn't large enough
20 * to store value passed as an argument.
21 * After initialization call StartHandler providing path to the
22 * database, where minidumps will be stored.
23 */
24 class CrashReportContext final
25 {
26 static constexpr size_t MaxBufferLength{ 2048 };
27 static constexpr size_t MaxCommandLength{ 8192 };
28
29 wchar_t mSenderPath[MaxBufferLength]{};
30 wchar_t mReportURL[MaxBufferLength]{};
31 wchar_t mParameters[MaxBufferLength]{};
32
33 //this is a buffer where the command will be built at runtime
34 wchar_t mCommand[MaxCommandLength]{};
35
36 public:
37 bool SetSenderPathUTF8(const std::string& path);
38 bool SetReportURL(const std::string& path);
39 bool SetParameters(const std::map<std::string, std::string>& p);
40
41 void StartHandler(const std::string& databasePath);
42
43 private:
44 //helper functions which need access to a private data, but should not be exposed to a public class interface
45 friend bool MakeCommand(CrashReportContext* ctx, const wchar_t* path, const wchar_t* id);
46 friend bool SendReport(CrashReportContext* ctx, const wchar_t* path, const wchar_t* id);
47 };