39 std::optional<std::reference_wrapper<const Identity>> m_wrapped;
52 Entry(
const Identity& ident, int16_t ind, Type type,
bool mustHave =
true,
const std::type_info* owner =
nullptr) :
53 Entry{
ID{ident}, ind, type, mustHave, owner} {}
54 Entry(
Identity&& ident, int16_t ind, Type type,
bool mustHave =
true,
const std::type_info* owner =
nullptr) :
55 Entry{ID{std::move(ident)}, ind, type, mustHave, owner} {}
64 Entry(
const Identity& ident, int16_t ind,
size_t howMany, std::optional<size_t> max = 1,
bool mustHave =
true,
const std::type_info* owner =
nullptr) :
65 Entry{
ID{ident}, ind, howMany, max, mustHave, owner} {}
66 Entry(
Identity&& ident, int16_t ind,
size_t howMany, std::optional<size_t> max = 1,
bool mustHave =
true,
const std::type_info* owner =
nullptr) :
Entry{ID{std::move(ident)}, ind, howMany, max, mustHave, owner} {}
68 Entry& operator=(
const Entry& source) =
default;
89 bool isAttribute()
const {
return (m_type == attribute); }
94 bool isRepeating()
const {
return (!m_maximum || (m_maximum > 1)); }
99 std::optional<size_t>
maximum()
const {
return isAttribute() ? 1 : m_maximum; }
142 Entry(ID&&
id, int16_t ind, Type type,
bool mustHave,
const std::type_info* owner) : m_id{id} {
158 Entry(ID&&
id, int16_t ind,
size_t howMany, std::optional<size_t> max,
bool mustHave,
const std::type_info* owner) : m_id{id} {
161 if (m_maximum.has_value() && (*m_maximum <= 0))
172 std::optional<size_t> m_maximum = 1;
174 Type m_type = element;
const Identity & identity() const
Get the wrapped identity.
Definition Entry.h:35
bool required
True if required for export.
Definition Entry.h:79
Entry & withOwner(const std::type_info *owner)
Definition Entry.h:118
Entry(const Identity &ident, int16_t ind, size_t howMany, std::optional< size_t > max=1, bool mustHave=true, const std::type_info *owner=nullptr)
Definition Entry.h:64
size_t available
How many are currently available (also acts as the requested item on import/export in 'getCargo')
Definition Entry.h:75
void setIdentity(const Identity &ident)
Definition Entry.h:107
Entry(const Identity &ident, int16_t ind, Type type, bool mustHave=true, const std::type_info *owner=nullptr)
Definition Entry.h:52
void setIdentity(Identity &&ident)
Definition Entry.h:112
const Identity & identity() const
Get the wrapped identity.
Definition Entry.h:84
const std::type_info * ownerType
The type info of the owner package.
Definition Entry.h:73
std::optional< size_t > maximum() const
Definition Entry.h:99