Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
ItemStackMetadata Class Reference

#include <itemstackmetadata.h>

+ Inheritance diagram for ItemStackMetadata:
+ Collaboration diagram for ItemStackMetadata:

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 ToolCapabilitiesgetToolCapabilities (const ToolCapabilities &default_caps) const
 
void setToolCapabilities (const ToolCapabilities &caps)
 
void clearToolCapabilities ()
 
const std::optional< WearBarParams > & getWearBarParamOverride () const
 
void setWearBarParams (const WearBarParams &params)
 
void clearWearBarParams ()
 

Private Member Functions

void updateToolCapabilities ()
 
void updateWearBarParams ()
 

Private Attributes

bool toolcaps_overridden
 
ToolCapabilities toolcaps_override
 
std::optional< WearBarParamswear_bar_override
 

Additional Inherited Members

Constructor & Destructor Documentation

◆ ItemStackMetadata()

ItemStackMetadata::ItemStackMetadata ( )
inline

Member Function Documentation

◆ clear()

void ItemStackMetadata::clear ( )
overridevirtual

Reimplemented from SimpleMetadata.

References SimpleMetadata::clear(), updateToolCapabilities(), and updateWearBarParams().

Referenced by ItemStack::clear(), and ItemStackMetaRef::clearMeta().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearToolCapabilities()

void ItemStackMetadata::clearToolCapabilities ( )

References setString(), and TOOLCAP_KEY.

Referenced by ItemStackMetaRef::clearToolCapabilities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearWearBarParams()

void ItemStackMetadata::clearWearBarParams ( )

References setString(), and WEAR_BAR_KEY.

Referenced by ItemStackMetaRef::clearWearBarParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deSerialize()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getToolCapabilities()

const ToolCapabilities & ItemStackMetadata::getToolCapabilities ( const ToolCapabilities & default_caps) const
inline

References toolcaps_overridden, and toolcaps_override.

Referenced by ItemStack::getToolCapabilities().

+ Here is the caller graph for this function:

◆ getWearBarParamOverride()

const std::optional< WearBarParams > & ItemStackMetadata::getWearBarParamOverride ( ) const
inline

References wear_bar_override.

Referenced by ItemStack::getWearBarParams().

+ Here is the caller graph for this function:

◆ serialize()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setString()

bool ItemStackMetadata::setString ( const std::string & name,
std::string_view var )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setToolCapabilities()

void ItemStackMetadata::setToolCapabilities ( const ToolCapabilities & caps)

References ToolCapabilities::serializeJson(), setString(), and TOOLCAP_KEY.

Referenced by ItemStackMetaRef::setToolCapabilities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWearBarParams()

void ItemStackMetadata::setWearBarParams ( const WearBarParams & params)

References WearBarParams::serializeJson(), setString(), and WEAR_BAR_KEY.

Referenced by ItemStackMetaRef::setWearBarParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateToolCapabilities()

void ItemStackMetadata::updateToolCapabilities ( )
private

References SimpleMetadata::contains(), ToolCapabilities::deserializeJson(), SimpleMetadata::getString(), TOOLCAP_KEY, toolcaps_overridden, and toolcaps_override.

Referenced by clear(), deSerialize(), and setString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateWearBarParams()

void ItemStackMetadata::updateWearBarParams ( )
private

References SimpleMetadata::contains(), WearBarParams::deserializeJson(), SimpleMetadata::getString(), WEAR_BAR_KEY, and wear_bar_override.

Referenced by clear(), deSerialize(), and setString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ toolcaps_overridden

bool ItemStackMetadata::toolcaps_overridden
private

◆ toolcaps_override

ToolCapabilities ItemStackMetadata::toolcaps_override
private

◆ wear_bar_override

std::optional<WearBarParams> ItemStackMetadata::wear_bar_override
private

The documentation for this class was generated from the following files: