2022-01-10 21:16:05 +01:00
|
|
|
#ifndef BILLYSHEET_ADRESSE_HPP
|
|
|
|
#define BILLYSHEET_ADRESSE_HPP
|
|
|
|
|
|
|
|
#include <cstdint>
|
2022-01-14 22:06:25 +01:00
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
|
|
|
|
using json = nlohmann::json;
|
2022-01-10 21:16:05 +01:00
|
|
|
|
|
|
|
namespace character::characteristic {
|
2022-01-10 21:34:54 +01:00
|
|
|
class Adresse final {
|
2022-01-10 21:16:05 +01:00
|
|
|
private:
|
|
|
|
const std::uint32_t base{ 1 };
|
|
|
|
std::uint32_t carac{ 0 };
|
|
|
|
std::uint32_t materiel{ 0 };
|
|
|
|
std::uint32_t additional{ 0 };
|
2022-01-10 21:34:54 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
Adresse() noexcept = default;
|
|
|
|
|
|
|
|
~Adresse() noexcept = default;
|
2022-01-14 22:06:25 +01:00
|
|
|
|
|
|
|
[[nodiscard]] std::uint32_t get_base() const { return base; }
|
|
|
|
|
|
|
|
[[nodiscard]] std::uint32_t get_carac() const { return carac; }
|
|
|
|
|
|
|
|
[[nodiscard]] std::uint32_t get_materiel() const { return materiel; }
|
|
|
|
|
|
|
|
[[nodiscard]] std::uint32_t get_additional() const { return additional; }
|
|
|
|
|
|
|
|
friend void from_json(const json &j, Adresse &adresse) {
|
|
|
|
const_cast<std::uint32_t&>(adresse.base) = j.at("base");
|
|
|
|
adresse.carac = j.at("carac");
|
|
|
|
adresse.materiel =j.at("materiel");
|
|
|
|
adresse.additional =j.at("additional");
|
|
|
|
}
|
2022-01-10 21:16:05 +01:00
|
|
|
};
|
2022-01-14 22:06:25 +01:00
|
|
|
|
|
|
|
void to_json(json &j, const Adresse &adresse) {
|
|
|
|
j.emplace("base", adresse.get_base());
|
|
|
|
j.emplace("carac", adresse.get_carac());
|
|
|
|
j.emplace("materiel", adresse.get_materiel());
|
|
|
|
j.emplace("additional", adresse.get_additional());
|
|
|
|
}
|
2022-01-10 21:16:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif //BILLYSHEET_ADRESSE_HPP
|