diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-03-31 15:37:53 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-03-31 15:37:53 -0700 |
commit | 59972bd1b723d6a2441ef74d724b1355e07fea2f (patch) | |
tree | 68a82bf239e2d65f5d419ae6b208d5b1db754c63 /src/support/file.h | |
parent | d0ae4a2d778a92be712d3f510f94273bb3e394da (diff) | |
download | binaryen-59972bd1b723d6a2441ef74d724b1355e07fea2f.tar.gz binaryen-59972bd1b723d6a2441ef74d724b1355e07fea2f.tar.bz2 binaryen-59972bd1b723d6a2441ef74d724b1355e07fea2f.zip |
refactor file flags into enums
Diffstat (limited to 'src/support/file.h')
-rw-r--r-- | src/support/file.h | 20 |
1 files changed, 16 insertions, 4 deletions
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 <vector> namespace wasm { + +namespace Flags { + enum BinaryOption { + Binary, + Text + }; + enum DebugOption { + Debug, + Release + }; +} + template <typename T> -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<char> read_file<>(const std::string &, bool, bool); +extern template std::string read_file<>(const std::string &, Flags::BinaryOption, Flags::DebugOption); +extern template std::vector<char> 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 <typename T> std::ostream &operator<<(const T &v) { |