Serialize and deserialize.

This commit is contained in:
Pcornat 2022-01-14 22:58:16 +01:00
parent e762ab05c6
commit 7b6eca1067
Signed by: Pcornat
GPG key ID: 2F3932FF46D9ECA0
6 changed files with 96 additions and 60 deletions

View file

@ -1,27 +1,28 @@
//
// Created by postaron on 10/01/2022.
//
#ifndef BILLYSHEET_ENDURANCE_HPP
#define BILLYSHEET_ENDURANCE_HPP
#include <cstdint>
#include "characteristic.hpp"
#include <nlohmann/json.hpp>
using json = nlohmann::json;
namespace character::characteristic {
class Endurance final {
private:
const std::uint32_t base{ 2 };
std::uint32_t carac{ 0 };
std::uint32_t materiel{ 0 };
std::uint32_t additional{ 0 };
class Endurance final : public Characteristic {
public:
Endurance() noexcept = default;
Endurance() noexcept: Characteristic(2, 0, 0, 0) {};
~Endurance() noexcept = default;
~Endurance() noexcept final = default;
[[nodiscard]] std::uint32_t get_max_lp() const noexcept;
friend void from_json(const json &j, Endurance &endurance) {
nlohmann::from_json(j, static_cast<Characteristic &>(endurance));
}
};
void to_json(json &j, const Endurance &endurance) {
to_json(j, static_cast<Characteristic>(endurance));
}
}