Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | Public Attributes | List of all members
core::file::ItemDB Struct Reference

Loads and stores metadata surrounding items in the game. More...

#include <ItemDB.hpp>

+ Inheritance diagram for core::file::ItemDB:

Public Member Functions

bool load ()
 Loads the item metadata from the data file. More...
 
bool loadDev (std::istream &input)
 Loads the database from its json format. More...
 
bool loadProd (bl::serial::binary::InputStream &input)
 Loads the database from its json format. More...
 
bool save () const
 Writes the item metadata to the data file. More...
 
bool saveBundle (bl::serial::binary::OutputStream &output, bl::resource::bundle::FileHandlerContext &ctx) const
 Saves the data from this object to the given bundle and registers depency files if any. More...
 

Public Attributes

std::unordered_map< item::Id, std::string > names
 
std::unordered_map< item::Id, std::string > descriptions
 
std::unordered_map< item::Id, std::int32_t > values
 

Detailed Description

Loads and stores metadata surrounding items in the game.

Definition at line 24 of file ItemDB.hpp.

Member Function Documentation

◆ load()

bool core::file::ItemDB::load ( )

Loads the item metadata from the data file.

Returns
True on success false on error

Definition at line 11 of file ItemDB.cpp.

◆ loadDev()

bool core::file::ItemDB::loadDev ( std::istream &  input)

Loads the database from its json format.

Parameters
inputThe input stream to load from
Returns
True if the data could be loaded, false otherwise

Definition at line 15 of file ItemDB.cpp.

◆ loadProd()

bool core::file::ItemDB::loadProd ( bl::serial::binary::InputStream &  input)

Loads the database from its json format.

Parameters
inputThe input stream to load from
Returns
True if the data could be loaded, false otherwise

Definition at line 19 of file ItemDB.cpp.

◆ save()

bool core::file::ItemDB::save ( ) const

Writes the item metadata to the data file.

Returns
True on success false on error

Definition at line 23 of file ItemDB.cpp.

◆ saveBundle()

bool core::file::ItemDB::saveBundle ( bl::serial::binary::OutputStream &  output,
bl::resource::bundle::FileHandlerContext &  ctx 
) const

Saves the data from this object to the given bundle and registers depency files if any.

Parameters
outputStream to output to
ctxContext to register dependencies with
Returns
True if serialization succeeded, false otherwise

Definition at line 28 of file ItemDB.cpp.

Member Data Documentation

◆ descriptions

std::unordered_map<item::Id, std::string> core::file::ItemDB::descriptions

Definition at line 66 of file ItemDB.hpp.

◆ names

std::unordered_map<item::Id, std::string> core::file::ItemDB::names

Definition at line 65 of file ItemDB.hpp.

◆ values

std::unordered_map<item::Id, std::int32_t> core::file::ItemDB::values

Definition at line 67 of file ItemDB.hpp.


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