Pyrogenesis  trunk
UserReport.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 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 
22 
24 {
25 public:
26  CUserReporter();
28 
29  void Initialize();
30  void Deinitialize();
31 
32  /**
33  * Must be called frequently (preferably every frame), to update some
34  * internal reconnection timers.
35  */
36  void Update();
37 
38  // Functions for the GUI to control the reporting:
39  bool IsReportingEnabled();
40  void SetReportingEnabled(bool enabled);
41  std::string GetStatus();
42 
43  /**
44  * Submit a report to be transmitted to the online server.
45  * Nothing will be transmitted until reporting is enabled by the user, so
46  * you don't need to check for that first.
47  * @param type short string identifying the type of data ("hwdetect", "message", etc)
48  * @param version positive integer that should be incremented if the data is changed in
49  * a non-compatible way and the server will have to distinguish old and new formats
50  * @param data the actual data (typically UTF-8-encoded text, or JSON, but could be binary)
51  */
52  void SubmitReport(const char* type, int version, const std::string& data);
53 
54 private:
55  std::string LoadUserID();
56 
58 };
59 
61 
62 #endif // INCLUDED_USERREPORT
void Update()
Must be called frequently (preferably every frame), to update some internal reconnection timers...
Definition: UserReport.cpp:610
std::string GetStatus()
Definition: UserReport.cpp:564
CUserReporterWorker * m_Worker
Definition: UserReport.h:57
void SubmitReport(const char *type, int version, const std::string &data)
Submit a report to be transmitted to the online server.
Definition: UserReport.cpp:616
CUserReporter g_UserReporter
Definition: UserReport.cpp:73
~CUserReporter()
Definition: UserReport.cpp:513
Definition: UserReport.h:23
CUserReporter()
Definition: UserReport.cpp:508
std::string LoadUserID()
Definition: UserReport.cpp:518
void SetReportingEnabled(bool enabled)
Definition: UserReport.cpp:554
Definition: UserReport.cpp:83
void Initialize()
Definition: UserReport.cpp:573
bool IsReportingEnabled()
Definition: UserReport.cpp:547
void Deinitialize()
Definition: UserReport.cpp:590