Minetest  5.4.0
Metadata Class Reference

#include <metadata.h>

+ Inheritance diagram for Metadata:
+ Collaboration diagram for Metadata:

Public Member Functions

virtual ~Metadata ()=default
 
virtual void clear ()
 
virtual bool empty () const
 
bool operator== (const Metadata &other) const
 
bool operator!= (const Metadata &other) const
 
size_t size () const
 
bool contains (const std::string &name) const
 
const std::string & getString (const std::string &name, u16 recursion=0) const
 
bool getStringToRef (const std::string &name, std::string &str, u16 recursion=0) const
 
virtual bool setString (const std::string &name, const std::string &var)
 Sets var to name key in the metadata storage. More...
 
bool removeString (const std::string &name)
 
const StringMapgetStrings () const
 
const std::string & resolveString (const std::string &str, u16 recursion=0) const
 
bool isModified () const
 
void setModified (bool v)
 

Protected Attributes

StringMap m_stringvars
 

Private Attributes

bool m_modified = false
 

Constructor & Destructor Documentation

◆ ~Metadata()

virtual Metadata::~Metadata ( )
virtualdefault

Member Function Documentation

◆ clear()

void Metadata::clear ( )
virtual

Reimplemented in ItemStackMetadata, NodeMetadata, and ModMetadata.

References m_modified, and m_stringvars.

Referenced by ModMetadata::clear(), NodeMetadata::clear(), ItemStackMetadata::clear(), and PlayerMetaRef::clearMeta().

+ Here is the caller graph for this function:

◆ contains()

bool Metadata::contains ( const std::string &  name) const

References m_stringvars.

Referenced by MetaDataRef::l_contains(), operator==(), and ItemStackMetadata::updateToolCapabilities().

+ Here is the caller graph for this function:

◆ empty()

bool Metadata::empty ( ) const
virtual

Reimplemented in NodeMetadata.

References m_stringvars.

Referenced by NodeMetadata::empty(), and ItemStack::serialize().

+ Here is the caller graph for this function:

◆ getString()

const std::string & Metadata::getString ( const std::string &  name,
u16  recursion = 0 
) const

◆ getStrings()

const StringMap& Metadata::getStrings ( ) const
inline

References m_stringvars.

Referenced by MetaDataRef::handleToTable(), LuaItemStack::l_to_table(), PlayerDatabaseLevelDB::savePlayer(), PlayerDatabaseSQLite3::savePlayer(), and PlayerDatabaseFiles::serialize().

+ Here is the caller graph for this function:

◆ getStringToRef()

bool Metadata::getStringToRef ( const std::string &  name,
std::string &  str,
u16  recursion = 0 
) const

References m_stringvars, and resolveString().

Referenced by MetaDataRef::l_get(), and ObjectRef::l_get_attribute().

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

◆ isModified()

bool Metadata::isModified ( ) const
inline

References m_modified.

◆ operator!=()

bool Metadata::operator!= ( const Metadata other) const
inline

◆ operator==()

bool Metadata::operator== ( const Metadata other) const

References contains(), getString(), m_stringvars, and size().

+ Here is the call graph for this function:

◆ removeString()

bool Metadata::removeString ( const std::string &  name)
inline

References setString().

Referenced by ObjectRef::l_set_attribute().

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

◆ resolveString()

const std::string & Metadata::resolveString ( const std::string &  str,
u16  recursion = 0 
) const

References getString().

Referenced by getString(), getStringToRef(), and NodeMetadataFormSource::resolveText().

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

◆ setModified()

void Metadata::setModified ( bool  v)
inline

References m_modified.

Referenced by PlayerDatabaseFiles::deSerialize(), PlayerDatabaseLevelDB::loadPlayer(), PlayerDatabaseSQLite3::loadPlayer(), and RemotePlayer::onSuccessfulSave().

+ Here is the caller graph for this function:

◆ setString()

bool Metadata::setString ( const std::string &  name,
const std::string &  var 
)
virtual

Sets var to name key in the metadata storage.

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

Reimplemented in ItemStackMetadata, and ModMetadata.

References m_modified, and m_stringvars.

Referenced by content_nodemeta_deserialize_legacy_body(), PlayerDatabaseFiles::deSerialize(), MetaDataRef::handleFromTable(), ObjectRef::l_set_attribute(), MetaDataRef::l_set_float(), MetaDataRef::l_set_int(), MetaDataRef::l_set_string(), PlayerDatabaseLevelDB::loadPlayer(), PlayerDatabaseSQLite3::loadPlayer(), removeString(), ModMetadata::setString(), and ItemStackMetadata::setString().

+ Here is the caller graph for this function:

◆ size()

size_t Metadata::size ( ) const

References m_stringvars.

Referenced by operator==(), and ItemStack::serialize().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_modified

bool Metadata::m_modified = false
private

◆ m_stringvars


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