Peoplemon  0.1.0
Peoplemon 3 game source documentation
ItemDB.cpp
Go to the documentation of this file.
1 #include <Core/Files/ItemDB.hpp>
2 
3 #include <Core/Properties.hpp>
4 #include <Core/Resources.hpp>
5 
6 namespace core
7 {
8 namespace file
9 {
10 
11 bool ItemDB::load() {
12  return ItemDbManager::initializeExisting(Properties::ItemMetadataFile(), *this);
13 }
14 
15 bool ItemDB::loadDev(std::istream& input) {
16  return bl::serial::json::Serializer<ItemDB>::deserializeStream(input, *this);
17 }
18 
19 bool ItemDB::loadProd(bl::serial::binary::InputStream& input) {
20  return bl::serial::binary::Serializer<ItemDB>::deserialize(input, *this);
21 }
22 
23 bool ItemDB::save() const {
24  std::ofstream output(Properties::ItemMetadataFile().c_str());
25  return bl::serial::json::Serializer<ItemDB>::serializeStream(output, *this, 4, 0);
26 }
27 
28 bool ItemDB::saveBundle(bl::serial::binary::OutputStream& output,
29  bl::resource::bundle::FileHandlerContext&) const {
30  return bl::serial::binary::Serializer<ItemDB>::serialize(output, *this);
31 }
32 
33 } // namespace file
34 } // namespace core
Core classes and functionality for both the editor and game.
bool loadProd(bl::serial::binary::InputStream &input)
Loads the database from its json format.
Definition: ItemDB.cpp:19
bool save() const
Writes the item metadata to the data file.
Definition: ItemDB.cpp:23
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.
Definition: ItemDB.cpp:28
bool loadDev(std::istream &input)
Loads the database from its json format.
Definition: ItemDB.cpp:15
bool load()
Loads the item metadata from the data file.
Definition: ItemDB.cpp:11
static const std::string & ItemMetadataFile()
Definition: Properties.cpp:590