summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/StatSerializer.h
blob: 6b7efddbbec11363f75ab340f52673ee817a0d10 (plain) (blame)
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

// StatSerializer.h

// Declares the cStatSerializer class that is used for saving stats into JSON





#pragma once

#include "json/json.h"





// fwd:
class cStatManager;




class cStatSerializer
{
public:

	cStatSerializer(const AString & a_WorldName, const AString & a_PlayerName, cStatManager * a_Manager);

	/* Try to load the player statistics. Returns whether the operation was successful or not. */
	bool Load(void);

	/* Try to save the player statistics. Returns whether the operation was successful or not. */
	bool Save(void);


protected:

	void SaveStatToJSON(Json::Value & a_Out);

	bool LoadStatFromJSON(const Json::Value & a_In);


private:

	cStatManager * m_Manager;

	AString m_Path;


} ;