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