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