In this exercise, we will create a parser to fill data that represents players and their inventory in an RPG game. First, let's create the types that will hold the data:
class InventoryItem { Q_GADGET public: enum class Type { Weapon, Armor, Gem, Book, Other }; Q_ENUM(Type) Type type; QString subType; int durability; static Type typeByName(const QStringRef &r); }; class Player { public: QString name; QString password; int experience; int hitPoints; QVector<InventoryItem> inventory; QString location; QPoint position; }; struct PlayerInfo { QVector<Player> players; };