| 1692 | } |
| 1693 | |
| 1694 | void Model::restore(const std::string& image, const Store& store) { |
| 1695 | Img m{image}; |
| 1696 | uint32_t magic = 0; |
| 1697 | m.get(magic); |
| 1698 | if (magic != 0x31474d49) throw std::runtime_error("fnx: not a holder's image"); |
| 1699 | for (CardW& c : cards) { |
| 1700 | card_fields(c, [&](auto& v) { m.get(v); }); |
| 1701 | m.get_vec(c.L); |
| 1702 | m.get_vec(c.ec_host_gu); |
| 1703 | m.get_vec(c.ec_host_dn); |
| 1704 | if (c.L.size() != (size_t) NL) throw std::runtime_error("fnx: the holder's image has another layer count"); |
| 1705 | card_ptrs(c, [&](auto& p) { store.move_ptr(p); }); |
| 1706 | } |
| 1707 | if (m.at != image.size()) throw std::runtime_error("fnx: the holder's image is longer than its cards"); |
| 1708 | } |
| 1709 | |
| 1710 | } // namespace fnx |
no test coverage detected