Pyrogenesis  trunk
UserReport.h
Go to the documentation of this file.
1 /* Copyright (C) 2018 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_USERREPORT
19 #define INCLUDED_USERREPORT
20 
21 #include <string>
22 
24 
26 {
27 public:
28  CUserReporter();
30 
31  void Initialize();
32  void Deinitialize();
33 
34  /**
35  * Must be called frequently (preferably every frame), to update some
36  * internal reconnection timers.
37  */
38  void Update();
39 
40  // Functions for the GUI to control the reporting:
41  bool IsReportingEnabled();
42  void SetReportingEnabled(bool enabled);
43  std::string GetStatus();
44 
45  /**
46  * Submit a report to be transmitted to the online server.
47  * Nothing will be transmitted until reporting is enabled by the user, so
48  * you don't need to check for that first.
49  * @param type short string identifying the type of data ("hwdetect", "message", etc)
50  * @param version positive integer that should be incremented if the data is changed in
51  * a non-compatible way and the server will have to distinguish old and new formats
52  * @param data the actual data (typically UTF-8-encoded text, or JSON, but could be binary)
53  * @param dataHumanReadable an optional, readable representation of the same data, allowing users to assess for privacy concerns
54  */
55  void SubmitReport(const std::string& type, int version, const std::string& data, const std::string& dataHumanReadable);
56 
57 private:
58  std::string LoadUserID();
59 
61 };
62 
64 
65 #endif // INCLUDED_USERREPORT
void Update()
Must be called frequently (preferably every frame), to update some internal reconnection timers...
Definition: UserReport.cpp:604
void SubmitReport(const std::string &type, int version, const std::string &data, const std::string &dataHumanReadable)
Submit a report to be transmitted to the online server.
Definition: UserReport.cpp:610
std::string GetStatus()
Definition: UserReport.cpp:565
CUserReporterWorker * m_Worker
Definition: UserReport.h:60
CUserReporter g_UserReporter
Definition: UserReport.cpp:81
~CUserReporter()
Definition: UserReport.cpp:514
Definition: UserReport.h:25
CUserReporter()
Definition: UserReport.cpp:509
std::string LoadUserID()
Definition: UserReport.cpp:519
void SetReportingEnabled(bool enabled)
Definition: UserReport.cpp:555
Definition: UserReport.cpp:91
void Initialize()
Definition: UserReport.cpp:573
bool IsReportingEnabled()
Definition: UserReport.cpp:548
void Deinitialize()
Definition: UserReport.cpp:586