summaryrefslogtreecommitdiffstats
path: root/examples/corelib/json/savegame/level.h
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2017-08-22 09:52:55 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2017-08-31 11:46:04 +0000
commit1ff52e478bab33f3aaba5ec185295411a0e6867d (patch)
tree7df3f79b86716b3eef11ce1240fc17ee9431449c /examples/corelib/json/savegame/level.h
parent29ef0d2bccd1874e20de94485ee05777c3a95c5d (diff)
Modernize the json savegame example
Task-number: QTBUG-60625 Change-Id: I8d5bf860478ee2566b9f96854fc6491f088a28fa Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'examples/corelib/json/savegame/level.h')
-rw-r--r--examples/corelib/json/savegame/level.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/corelib/json/savegame/level.h b/examples/corelib/json/savegame/level.h
index 878510e9d5..393524abfd 100644
--- a/examples/corelib/json/savegame/level.h
+++ b/examples/corelib/json/savegame/level.h
@@ -52,7 +52,7 @@
#define LEVEL_H
#include <QJsonObject>
-#include <QList>
+#include <QVector>
#include "character.h"
@@ -60,15 +60,21 @@
class Level
{
public:
- Level();
+ Level() = default;
+ Level(const QString &name);
- const QList<Character> &npcs() const;
- void setNpcs(const QList<Character> &npcs);
+ QString name() const;
+
+ QVector<Character> npcs() const;
+ void setNpcs(const QVector<Character> &npcs);
void read(const QJsonObject &json);
void write(QJsonObject &json) const;
+
+ void print(int indentation = 0) const;
private:
- QList<Character> mNpcs;
+ QString mName;
+ QVector<Character> mNpcs;
};
//! [0]