QtCraft API C++ classes QML types Handbook

QcItemSerializer Namespace

The definition of an item in the content sync (QcContentSerializer): its stack, tool, food and fuel values, tags, what it places or fills, its armour (QcArmourSerializer) and how it is used (launcher, projectile, throwable, drink, fishing rod). More...

Header: #include <common/content/items/QcItemSerializer.h>

Functions

std::optional<QcItemDefinition> read(QDataStream &stream)
void write(QDataStream &stream, const QcItemDefinition &item)

Detailed Description

Written by the server, read and checked by the client.

Function Documentation

std::optional<QcItemDefinition> QcItemSerializer::read(QDataStream &stream)

Returns the item read from stream; std::nullopt when the data is corrupt or out of the parser's limits. The caller registers it (and refuses a duplicate name).

void QcItemSerializer::write(QDataStream &stream, const QcItemDefinition &item)

Writes item to stream, without its server-only fields.