From 1d6d1e680ee1bb6f90328e74ce5e11f8ecb0217e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Feb 2018 11:12:04 +0100 Subject: Fix some qdoc-warnings for 5.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename example savegame and its snippets following a6b697ca13945a174cff9f3e9b1af1cf61c0bea5. Fix: /qtbase/examples/corelib/serialization/savegame/doc/src/savegame.qdoc:28: warning: Cannot find file 'json/savegame/savegame.pro' or 'json/savegame/savegame.qmlproject' qtbase/examples/corelib/serialization/savegame/doc/src/savegame.qdoc:98: (qdoc) warning: Cannot find file to quote from: 'json/savegame/level.cpp' json qtbase/src/network/ssl/qsslconfiguration.cpp:889: warning: Undocumented parameter 'name' in QSslConfiguration::setBackendConfigOption() qtbase/src/corelib/tools/qbitarray.cpp:314: warning: No such parameter 'len' in QBitArray::fromBits() Change-Id: If59512873ca2116b89490927fdbf9ea1d8b237a8 Reviewed-by: Topi Reiniƶ Reviewed-by: Martin Smith --- .../serialization/savegame/doc/src/savegame.qdoc | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'examples/corelib') diff --git a/examples/corelib/serialization/savegame/doc/src/savegame.qdoc b/examples/corelib/serialization/savegame/doc/src/savegame.qdoc index 06e70680c6..a35f763430 100644 --- a/examples/corelib/serialization/savegame/doc/src/savegame.qdoc +++ b/examples/corelib/serialization/savegame/doc/src/savegame.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example json/savegame + \example serialization/savegame \title JSON Save Game Example \brief The JSON Save Game example demonstrates how to save and load a @@ -50,12 +50,12 @@ It provides read() and write() functions to serialise its member variables. - \snippet json/savegame/character.h 0 + \snippet serialization/savegame/character.h 0 Of particular interest to us are the read and write function implementations: - \snippet json/savegame/character.cpp 0 + \snippet serialization/savegame/character.cpp 0 In the read() function, we assign Character's members values from the QJsonObject argument. You can use either \l QJsonObject::operator[]() or @@ -64,7 +64,7 @@ check if the keys are valid before attempting to read them with QJsonObject::contains(). - \snippet json/savegame/character.cpp 1 + \snippet serialization/savegame/character.cpp 1 In the write() function, we do the reverse of the read() function; assign values from the Character object to the JSON object. As with accessing @@ -74,13 +74,13 @@ Next up is the Level class: - \snippet json/savegame/level.h 0 + \snippet serialization/savegame/level.h 0 We want to have several levels in our game, each with several NPCs, so we keep a QVector of Character objects. We also provide the familiar read() and write() functions. - \snippet json/savegame/level.cpp 0 + \snippet serialization/savegame/level.cpp 0 Containers can be written and read to and from JSON using QJsonArray. In our case, we construct a QJsonArray from the value associated with the key @@ -94,7 +94,7 @@ element is used as the key to construct the container when reading it back in. - \snippet json/savegame/level.cpp 1 + \snippet serialization/savegame/level.cpp 1 Again, the write() function is similar to the read() function, except reversed. @@ -102,7 +102,7 @@ Having established the Character and Level classes, we can move on to the Game class: - \snippet json/savegame/game.h 0 + \snippet serialization/savegame/game.h 0 First of all, we define the \c SaveFormat enum. This will allow us to specify the format in which the game should be saved: \c Json or \c Binary. @@ -112,12 +112,12 @@ The read() and write() functions are used by saveGame() and loadGame(). - \snippet json/savegame/game.cpp 0 + \snippet serialization/savegame/game.cpp 0 To setup a new game, we create the player and populate the levels and their NPCs. - \snippet json/savegame/game.cpp 1 + \snippet serialization/savegame/game.cpp 1 The first thing we do in the read() function is tell the player to read itself. We then clear the level array so that calling loadGame() on the @@ -125,11 +125,11 @@ We then populate the level array by reading each Level from a QJsonArray. - \snippet json/savegame/game.cpp 2 + \snippet serialization/savegame/game.cpp 2 We write the game to JSON similarly to how we write Level. - \snippet json/savegame/game.cpp 3 + \snippet serialization/savegame/game.cpp 3 When loading a saved game in loadGame(), the first thing we do is open the save file based on which format it was saved to; \c "save.json" for JSON, @@ -144,7 +144,7 @@ After constructing the QJsonDocument, we instruct the Game object to read itself and then return \c true to indicate success. - \snippet json/savegame/game.cpp 4 + \snippet serialization/savegame/game.cpp 4 Not surprisingly, saveGame() looks very much like loadGame(). We determine the file extension based on the format, print a warning and return \c false @@ -155,7 +155,7 @@ We are now ready to enter main(): - \snippet json/savegame/main.cpp 0 + \snippet serialization/savegame/main.cpp 0 Since we're only interested in demonstrating \e serialization of a game with JSON, our game is not actually playable. Therefore, we only need @@ -169,7 +169,7 @@ assume that the player had a great time and made lots of progress, altering the internal state of our Character, Level and Game objects. - \snippet json/savegame/main.cpp 1 + \snippet serialization/savegame/main.cpp 1 When the player has finished, we save their game. For demonstration purposes, we can serialize to either JSON or binary. You can examine the -- cgit v1.2.3