QcPlayerStorage Class
The player files of a world directory (players/<name>-<hash>.qcp, decision E-093): position, view, inventory and armour, health and food, the game mode with the kept inventory of the other mode, the experience, the advancements. More...
| Header: | #include <server/storage/QcPlayerStorage.h> |
Public Types
Public Functions
| QByteArray | bytes(const QcPlayerData &player) const |
| QcPlayerStorage::Result | parse(const QString &playerName, const std::optional<QByteArray> &contents) const |
| QcPlayerStorage::Result | read(const QString &playerName) const |
| QcStatus | write(const QString &playerName, const QcPlayerData &player) const |
Static Public Members
| QString | fileName(const QString &playerName) |
| QString | relativePath(const QString &playerName) |
Detailed Description
Items are stored by name; unknown items are dropped with a warning.
Member Type Documentation
[alias] QcPlayerStorage::Result
A player as read, or why the file cannot be read.
Member Function Documentation
QByteArray QcPlayerStorage::bytes(const QcPlayerData &player) const
Returns the contents of the file of player, for a save that writes it with the world (decision E-378).
[static] QString QcPlayerStorage::fileName(const QString &playerName)
Returns the file of the player playerName in players/: the name in lower case (other characters than letters, digits, '_' and '-' replaced) and a hash of the exact name, "<name>-<hash>.qcp".
QcPlayerStorage::Result QcPlayerStorage::parse(const QString &playerName, const std::optional<QByteArray> &contents) const
Returns the player playerName read from contents of his file (none: never saved).
QcPlayerStorage::Result QcPlayerStorage::read(const QString &playerName) const
Returns the player playerName as read from his file. A file of an older development version is an error (decision E-356).
[static] QString QcPlayerStorage::relativePath(const QString &playerName)
Returns the file of the player playerName relative to the world directory ("players/<file name>").
QcStatus QcPlayerStorage::write(const QString &playerName, const QcPlayerData &player) const
Writes player to the file of playerName. Returns an error when it cannot be written.