Bump version to 6.4-15
[LibreOffice.git] / include / desktop / crashreport.hxx
blob8235cff0350150ffe78f0012790dd5b52aede586
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_DESKTOP_CRASHREPORT_HXX
11 #define INCLUDED_DESKTOP_CRASHREPORT_HXX
13 #include <desktop/dllapi.h>
15 #include <rtl/ustring.hxx>
16 #include <osl/mutex.hxx>
18 #include <config_features.h>
20 // vector not sort the entries
21 #include <memory>
22 #include <vector>
23 #include <string>
25 namespace google_breakpad
27 class ExceptionHandler;
30 /**
31 * Provides access to the crash reporter service.
33 * Valid keys are:
34 * * AdapterVendorId
35 * * AdapterDeviceId
38 class
39 #if HAVE_FEATURE_BREAKPAD
40 // MSVC 2013 has undefined symbols for inline functions if it's exported
41 CRASHREPORT_DLLPUBLIC
42 #endif
43 /*class*/ CrashReporter
45 public:
46 typedef enum {AddItem, Write, Create} tAddKeyHandling;
47 #if HAVE_FEATURE_BREAKPAD
48 static void addKeyValue(const OUString& rKey, const OUString& rValue, tAddKeyHandling AddKeyHandling);
50 static void installExceptionHandler();
51 static void removeExceptionHandler();
53 static bool crashReportInfoExists();
55 static bool readSendConfig(std::string& response);
57 static bool IsDumpEnable();
59 private:
60 static osl::Mutex maMutex;
61 static bool mbInit;
62 typedef struct _mpair
64 OUString first;
65 OUString second;
66 _mpair(const OUString& First, const OUString& Second)
68 first = First;
69 second = Second;
71 } mpair;
73 typedef std::vector<mpair> vmaKeyValues;
74 static vmaKeyValues maKeyValues; // used to temporarily save entries before the old info has been uploaded
76 static std::unique_ptr<google_breakpad::ExceptionHandler> mpExceptionHandler;
78 static std::string getIniFileName();
79 static void writeCommonInfo();
80 static void writeToFile(std::ios_base::openmode Openmode);
81 // when we create the ExceptionHandler we have no access to the user
82 // profile yet, so update when we have access
83 static void updateMinidumpLocation();
85 #else
86 // Add dummy methods for the non-breakpad case. That allows us to use
87 // // the code without linking to the lib and without adding HAVE_FEATURE_BREAKPAD
88 // // everywhere we want to log something to the crash report system.
89 inline static void addKeyValue(SAL_UNUSED_PARAMETER const OUString& /*rKey*/, SAL_UNUSED_PARAMETER const OUString& /*rValue*/, SAL_UNUSED_PARAMETER tAddKeyHandling /*AddKeyHandling*/) {};
90 #endif // HAVE_FEATURE_BREAKPAD
93 #endif // INCLUDED_DESKTOP_CRASHREPORT_HXX
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */