summaryrefslogtreecommitdiffstats
path: root/examples/corelib/serialization/savegame/game.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/corelib/serialization/savegame/game.h')
-rw-r--r--examples/corelib/serialization/savegame/game.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/corelib/serialization/savegame/game.h b/examples/corelib/serialization/savegame/game.h
index 266e764a80..5ba5952923 100644
--- a/examples/corelib/serialization/savegame/game.h
+++ b/examples/corelib/serialization/savegame/game.h
@@ -4,19 +4,19 @@
#ifndef GAME_H
#define GAME_H
+#include "character.h"
+#include "level.h"
+
#include <QJsonObject>
#include <QList>
-#include "character.h"
-#include "level.h"
+QT_FORWARD_DECLARE_CLASS(QTextStream)
//! [0]
class Game
{
public:
- enum SaveFormat {
- Json, Binary
- };
+ enum SaveFormat { Json, Binary };
Character player() const;
QList<Level> levels() const;
@@ -26,9 +26,10 @@ public:
bool saveGame(SaveFormat saveFormat) const;
void read(const QJsonObject &json);
- void write(QJsonObject &json) const;
+ QJsonObject toJson() const;
+
+ void print(QTextStream &s, int indentation = 0) const;
- void print(int indentation = 0) const;
private:
Character mPlayer;
QList<Level> mLevels;