Fix some qdoc-warnings for 5.11
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ö <topi.reinio@qt.io> Reviewed-by: Martin Smith <martin.smith@qt.io>
This commit is contained in:
parent
27b8e97e4f
commit
1d6d1e680e
@ -26,7 +26,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\example json/savegame
|
\example serialization/savegame
|
||||||
\title JSON Save Game Example
|
\title JSON Save Game Example
|
||||||
|
|
||||||
\brief The JSON Save Game example demonstrates how to save and load a
|
\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.
|
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
|
Of particular interest to us are the read and write function
|
||||||
implementations:
|
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
|
In the read() function, we assign Character's members values from the
|
||||||
QJsonObject argument. You can use either \l QJsonObject::operator[]() or
|
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
|
check if the keys are valid before attempting to read them with
|
||||||
QJsonObject::contains().
|
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
|
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
|
values from the Character object to the JSON object. As with accessing
|
||||||
@ -74,13 +74,13 @@
|
|||||||
|
|
||||||
Next up is the Level class:
|
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
|
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
|
keep a QVector of Character objects. We also provide the familiar read() and
|
||||||
write() functions.
|
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
|
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
|
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
|
element is used as the key to construct the container when reading it back
|
||||||
in.
|
in.
|
||||||
|
|
||||||
\snippet json/savegame/level.cpp 1
|
\snippet serialization/savegame/level.cpp 1
|
||||||
|
|
||||||
Again, the write() function is similar to the read() function, except
|
Again, the write() function is similar to the read() function, except
|
||||||
reversed.
|
reversed.
|
||||||
@ -102,7 +102,7 @@
|
|||||||
Having established the Character and Level classes, we can move on to
|
Having established the Character and Level classes, we can move on to
|
||||||
the Game class:
|
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
|
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.
|
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().
|
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
|
To setup a new game, we create the player and populate the levels and their
|
||||||
NPCs.
|
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
|
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
|
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.
|
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.
|
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
|
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,
|
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
|
After constructing the QJsonDocument, we instruct the Game object to read
|
||||||
itself and then return \c true to indicate success.
|
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
|
Not surprisingly, saveGame() looks very much like loadGame(). We determine
|
||||||
the file extension based on the format, print a warning and return \c false
|
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():
|
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
|
Since we're only interested in demonstrating \e serialization of a game with
|
||||||
JSON, our game is not actually playable. Therefore, we only need
|
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
|
assume that the player had a great time and made lots of progress, altering
|
||||||
the internal state of our Character, Level and Game objects.
|
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
|
When the player has finished, we save their game. For demonstration
|
||||||
purposes, we can serialize to either JSON or binary. You can examine the
|
purposes, we can serialize to either JSON or binary. You can examine the
|
||||||
|
@ -315,7 +315,7 @@ void QBitArray::fill(bool value, int begin, int end)
|
|||||||
\since 5.11
|
\since 5.11
|
||||||
|
|
||||||
Creates a QBitArray with the dense bit array located at \a data, with \a
|
Creates a QBitArray with the dense bit array located at \a data, with \a
|
||||||
len bits. The byte array at \a data must be at least \a size / 8 (rounded up)
|
size bits. The byte array at \a data must be at least \a size / 8 (rounded up)
|
||||||
bytes long.
|
bytes long.
|
||||||
|
|
||||||
If \a size is not a multiple of 8, this function will include the lowest
|
If \a size is not a multiple of 8, this function will include the lowest
|
||||||
|
@ -889,7 +889,7 @@ QMap<QByteArray, QVariant> QSslConfiguration::backendConfig() const
|
|||||||
/*!
|
/*!
|
||||||
\since 5.11
|
\since 5.11
|
||||||
|
|
||||||
Sets an option in the backend-specific configuration.
|
Sets the option \a name in the backend-specific configuration to \a value.
|
||||||
|
|
||||||
Options supported by the OpenSSL (>= 1.0.2) backend are available in the \l
|
Options supported by the OpenSSL (>= 1.0.2) backend are available in the \l
|
||||||
{https://www.openssl.org/docs/manmaster/man3/SSL_CONF_cmd.html#SUPPORTED-CONFIGURATION-FILE-COMMANDS}
|
{https://www.openssl.org/docs/manmaster/man3/SSL_CONF_cmd.html#SUPPORTED-CONFIGURATION-FILE-COMMANDS}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user