2020#include < limits>
2121
2222template <typename T>
23- T wasm::read_file (const std::string &filename, bool binary, bool debug) {
24- if (debug) std::cerr << " Loading '" << filename << " '..." << std::endl;
23+ T wasm::read_file (const std::string &filename, Flags::BinaryOption binary, Flags::DebugOption debug) {
24+ if (debug == Flags::Debug ) std::cerr << " Loading '" << filename << " '..." << std::endl;
2525 std::ifstream infile;
2626 auto flags = std::ifstream::in;
27- if (binary) flags |= std::ifstream::binary;
27+ if (binary == Flags::Binary ) flags |= std::ifstream::binary;
2828 infile.open (filename, flags);
2929 if (!infile.is_open ()) {
3030 std::cerr << " Failed opening '" << filename << " '" << std::endl;
@@ -44,16 +44,16 @@ T wasm::read_file(const std::string &filename, bool binary, bool debug) {
4444}
4545
4646// Explicit instantiations for the explicit specializations.
47- template std::string wasm::read_file<>(const std::string &, bool , bool );
48- template std::vector<char > wasm::read_file<>(const std::string &, bool , bool );
47+ template std::string wasm::read_file<>(const std::string &, Flags::BinaryOption, Flags::DebugOption );
48+ template std::vector<char > wasm::read_file<>(const std::string &, Flags::BinaryOption, Flags::DebugOption );
4949
50- wasm::Output::Output (const std::string &filename, bool binary, bool debug)
50+ wasm::Output::Output (const std::string &filename, Flags::BinaryOption binary, Flags::DebugOption debug)
5151 : outfile(), out([this , filename, binary, debug]() {
5252 std::streambuf *buffer;
5353 if (filename.size ()) {
54- if (debug) std::cerr << " Opening '" << filename << std::endl;
54+ if (debug == Flags::Debug ) std::cerr << " Opening '" << filename << std::endl;
5555 auto flags = std::ofstream::out | std::ofstream::trunc;
56- if (binary) flags |= std::ofstream::binary;
56+ if (binary == Flags::Binary ) flags |= std::ofstream::binary;
5757 outfile.open (filename, flags);
5858 if (!outfile.is_open ()) {
5959 std::cerr << " Failed opening '" << filename << " '" << std::endl;
0 commit comments