#include <itemstackmetadata.h>
Public Member Functions | |
ItemStackMetadata () | |
void | clear () override |
bool | setString (const std::string &name, std::string_view var) override |
void | serialize (std::ostream &os) const |
void | deSerialize (std::istream &is) |
const ToolCapabilities & | getToolCapabilities (const ToolCapabilities &default_caps) const |
void | setToolCapabilities (const ToolCapabilities &caps) |
void | clearToolCapabilities () |
const std::optional< WearBarParams > & | getWearBarParamOverride () const |
void | setWearBarParams (const WearBarParams ¶ms) |
void | clearWearBarParams () |
Public Member Functions inherited from SimpleMetadata | |
virtual | ~SimpleMetadata ()=default |
virtual bool | empty () const |
size_t | size () const |
bool | contains (const std::string &name) const override |
const StringMap & | getStrings (StringMap *) const override final |
const std::vector< std::string > & | getKeys (std::vector< std::string > *place) const override final |
const std::string & | getString (const std::string &name, u16 recursion=0) const |
const std::string & | resolveString (const std::string &str, u16 recursion=0) const |
const StringMap & | getStrings () const |
bool | isModified () const |
void | setModified (bool v) |
Public Member Functions inherited from IMetadata | |
virtual | ~IMetadata ()=default |
bool | operator== (const IMetadata &other) const |
bool | operator!= (const IMetadata &other) const |
const std::string & | getString (const std::string &name, std::string *place, u16 recursion=0) const |
bool | getStringToRef (const std::string &name, std::string &str, u16 recursion=0) const |
bool | removeString (const std::string &name) |
const std::string & | resolveString (const std::string &str, std::string *place, u16 recursion=0, bool deprecated=false) const |
Private Member Functions | |
void | updateToolCapabilities () |
void | updateWearBarParams () |
Private Attributes | |
bool | toolcaps_overridden |
ToolCapabilities | toolcaps_override |
std::optional< WearBarParams > | wear_bar_override |
Additional Inherited Members | |
Protected Member Functions inherited from SimpleMetadata | |
const std::string * | getStringRaw (const std::string &name, std::string *) const override final |
Protected Attributes inherited from SimpleMetadata | |
StringMap | m_stringvars |
|
inline |
|
overridevirtual |
Reimplemented from SimpleMetadata.
References SimpleMetadata::clear(), updateToolCapabilities(), and updateWearBarParams().
Referenced by ItemStack::clear(), and ItemStackMetaRef::clearMeta().
void ItemStackMetadata::clearToolCapabilities | ( | ) |
References setString(), and TOOLCAP_KEY.
Referenced by ItemStackMetaRef::clearToolCapabilities().
void ItemStackMetadata::clearWearBarParams | ( | ) |
References setString(), and WEAR_BAR_KEY.
Referenced by ItemStackMetaRef::clearWearBarParams().
void ItemStackMetadata::deSerialize | ( | std::istream & | is | ) |
References BasicStrfnd< T >::at_end(), DESERIALIZE_KV_DELIM_STR, DESERIALIZE_PAIR_DELIM_STR, DESERIALIZE_START, deSerializeJsonStringIfNeeded(), SimpleMetadata::m_stringvars, BasicStrfnd< T >::next(), BasicStrfnd< T >::to(), updateToolCapabilities(), and updateWearBarParams().
Referenced by ItemStack::deSerialize().
|
inline |
References toolcaps_overridden, and toolcaps_override.
Referenced by ItemStack::getToolCapabilities().
|
inline |
References wear_bar_override.
Referenced by ItemStack::getWearBarParams().
void ItemStackMetadata::serialize | ( | std::ostream & | os | ) | const |
References DESERIALIZE_KV_DELIM, DESERIALIZE_PAIR_DELIM, DESERIALIZE_START, SimpleMetadata::m_stringvars, and serializeJsonStringIfNeeded().
Referenced by ItemStack::serialize().
|
overridevirtual |
Reimplemented from SimpleMetadata.
References sanitize_string(), SimpleMetadata::setString(), TOOLCAP_KEY, updateToolCapabilities(), updateWearBarParams(), and WEAR_BAR_KEY.
Referenced by clearToolCapabilities(), clearWearBarParams(), LuaItemStack::l_set_metadata(), read_item(), setToolCapabilities(), and setWearBarParams().
void ItemStackMetadata::setToolCapabilities | ( | const ToolCapabilities & | caps | ) |
References ToolCapabilities::serializeJson(), setString(), and TOOLCAP_KEY.
Referenced by ItemStackMetaRef::setToolCapabilities().
void ItemStackMetadata::setWearBarParams | ( | const WearBarParams & | params | ) |
References WearBarParams::serializeJson(), setString(), and WEAR_BAR_KEY.
Referenced by ItemStackMetaRef::setWearBarParams().
|
private |
References SimpleMetadata::contains(), ToolCapabilities::deserializeJson(), SimpleMetadata::getString(), TOOLCAP_KEY, toolcaps_overridden, and toolcaps_override.
Referenced by clear(), deSerialize(), and setString().
|
private |
References SimpleMetadata::contains(), WearBarParams::deserializeJson(), SimpleMetadata::getString(), WEAR_BAR_KEY, and wear_bar_override.
Referenced by clear(), deSerialize(), and setString().
|
private |
Referenced by getToolCapabilities(), and updateToolCapabilities().
|
private |
Referenced by getToolCapabilities(), and updateToolCapabilities().
|
private |
Referenced by getWearBarParamOverride(), and updateWearBarParams().