summaryrefslogtreecommitdiff
path: root/mz/mz_header.hpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-06-22 00:15:08 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-06-22 00:16:28 +0200
commit22231518b9c2c0b7f73c72a6ca834df659c63c7f (patch)
tree12b1d20efd3303583649966ddfe135a81ae8109b /mz/mz_header.hpp
parent46145fe7d5b1d9f0921121a088a3d61f968cc473 (diff)
downloadopenwar-22231518b9c2c0b7f73c72a6ca834df659c63c7f.tar.gz
openwar-22231518b9c2c0b7f73c72a6ca834df659c63c7f.tar.bz2
openwar-22231518b9c2c0b7f73c72a6ca834df659c63c7f.zip
Reduces the amount of boilerplate neccesary to parse the binary format.
Diffstat (limited to 'mz/mz_header.hpp')
-rw-r--r--mz/mz_header.hpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/mz/mz_header.hpp b/mz/mz_header.hpp
index 9bef928..c783335 100644
--- a/mz/mz_header.hpp
+++ b/mz/mz_header.hpp
@@ -10,8 +10,6 @@
namespace mz {
-using namespace binparse;
-
struct NotAMZFileException : public std::runtime_error {
NotAMZFileException();
};
@@ -22,7 +20,11 @@ struct UnexpectedEOS : public std::runtime_error {
UnexpectedEOS(std::string location);
};
-struct MZHeader {
+using binparse::Magic16;
+using binparse::Value16;
+using binparse::Offset16;
+
+struct Header {
Magic16 magic;
Value16 bytes_in_last_block;
Value16 blocks_in_file;
@@ -39,8 +41,8 @@ struct MZHeader {
Value16 overlay_number;
};
-MZHeader parse_header(std::istream& is);
+Header parse_header(std::istream& is);
-std::ostream& operator<<(std::ostream& os, MZHeader const& header);
+std::ostream& operator<<(std::ostream& os, Header const& header);
}