From 59972bd1b723d6a2441ef74d724b1355e07fea2f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 31 Mar 2016 15:37:53 -0700 Subject: refactor file flags into enums --- src/support/file.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/support/file.h') diff --git a/src/support/file.h b/src/support/file.h index 8d92b5ab4..01c7a8546 100644 --- a/src/support/file.h +++ b/src/support/file.h @@ -28,16 +28,28 @@ #include namespace wasm { + +namespace Flags { + enum BinaryOption { + Binary, + Text + }; + enum DebugOption { + Debug, + Release + }; +} + template -T read_file(const std::string &filename, bool binary, bool debug); +T read_file(const std::string &filename, Flags::BinaryOption binary, Flags::DebugOption debug); // Declare the valid explicit specializations. -extern template std::string read_file<>(const std::string &, bool, bool); -extern template std::vector read_file<>(const std::string &, bool, bool); +extern template std::string read_file<>(const std::string &, Flags::BinaryOption, Flags::DebugOption); +extern template std::vector read_file<>(const std::string &, Flags::BinaryOption, Flags::DebugOption); class Output { public: // An empty filename will open stdout instead. - Output(const std::string &filename, bool binary, bool debug); + Output(const std::string &filename, Flags::BinaryOption binary, Flags::DebugOption debug); ~Output() = default; template std::ostream &operator<<(const T &v) { -- cgit v1.2.3