summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/StatSerializer.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-05-18 22:30:34 +0200
committerMattes D <github@xoft.cz>2014-05-18 22:30:34 +0200
commitac005681839134018f0162cfb8cb1453e11cbb46 (patch)
tree41cc966732262c0a8f5441932b758344856d6259 /src/WorldStorage/StatSerializer.h
parentMerge pull request #1005 from SphinxC0re/LoadPluginfolder (diff)
parentFixes (diff)
downloadcuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar.gz
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar.bz2
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar.lz
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar.xz
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar.zst
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/StatSerializer.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/WorldStorage/StatSerializer.h b/src/WorldStorage/StatSerializer.h
new file mode 100644
index 000000000..72f8d74f1
--- /dev/null
+++ b/src/WorldStorage/StatSerializer.h
@@ -0,0 +1,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;
+
+
+} ;
+
+
+
+