Minetest  5.4.0
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, const std::string &var) override
 Sets var to name key in the metadata storage. More...
 
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 ()
 

Private Member Functions

void updateToolCapabilities ()
 

Private Attributes

bool toolcaps_overridden
 
ToolCapabilities toolcaps_override
 

Additional Inherited Members

Constructor & Destructor Documentation

◆ ItemStackMetadata()

ItemStackMetadata::ItemStackMetadata ( )
inline

Member Function Documentation

◆ clear()

void ItemStackMetadata::clear ( )
overridevirtual

Reimplemented from Metadata.

References Metadata::clear(), and updateToolCapabilities().

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:

◆ deSerialize()

void ItemStackMetadata::deSerialize ( std::istream &  is)

References BasicStrfnd< T >::at_end(), DESERIALIZE_KV_DELIM_STR, DESERIALIZE_PAIR_DELIM_STR, DESERIALIZE_START, deSerializeJsonStringIfNeeded(), Metadata::m_stringvars, BasicStrfnd< T >::next(), BasicStrfnd< T >::to(), and updateToolCapabilities().

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:

◆ serialize()

void ItemStackMetadata::serialize ( std::ostream &  os) const

References DESERIALIZE_KV_DELIM, DESERIALIZE_PAIR_DELIM, DESERIALIZE_START, Metadata::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,
const std::string &  var 
)
overridevirtual

Sets var to name key in the metadata storage.

Parameters
name
var
Returns
true if key-value pair is created or changed

Reimplemented from Metadata.

References sanitize_string(), Metadata::setString(), TOOLCAP_KEY, and updateToolCapabilities().

Referenced by clearToolCapabilities(), LuaItemStack::l_set_metadata(), read_item(), and setToolCapabilities().

+ 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:

◆ updateToolCapabilities()

void ItemStackMetadata::updateToolCapabilities ( )
private

References Metadata::contains(), ToolCapabilities::deserializeJson(), Metadata::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:

Member Data Documentation

◆ toolcaps_overridden

bool ItemStackMetadata::toolcaps_overridden
private

◆ toolcaps_override

ToolCapabilities ItemStackMetadata::toolcaps_override
private

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