diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-06-22 00:15:08 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-06-22 00:16:28 +0200 |
| commit | 22231518b9c2c0b7f73c72a6ca834df659c63c7f (patch) | |
| tree | 12b1d20efd3303583649966ddfe135a81ae8109b /binparse/binparse.hpp | |
| parent | 46145fe7d5b1d9f0921121a088a3d61f968cc473 (diff) | |
| download | openwar-22231518b9c2c0b7f73c72a6ca834df659c63c7f.tar.gz openwar-22231518b9c2c0b7f73c72a6ca834df659c63c7f.tar.bz2 openwar-22231518b9c2c0b7f73c72a6ca834df659c63c7f.zip | |
Reduces the amount of boilerplate neccesary to parse the binary format.
Diffstat (limited to 'binparse/binparse.hpp')
| -rw-r--r-- | binparse/binparse.hpp | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/binparse/binparse.hpp b/binparse/binparse.hpp deleted file mode 100644 index e649ce7..0000000 --- a/binparse/binparse.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "types.hpp" - -#include <string> -#include <ostream> -#include <iomanip> -#include <vector> - -namespace binparse { - -struct UnexpectedEOS : public std::runtime_error { - UnexpectedEOS(); - - UnexpectedEOS(std::string location); -}; - -template<typename T> -T parse(std::istream& is, std::string name); - -template<> -uint8_t parse<uint8_t>(std::istream& is, std::string name); - -template<> -uint16_t parse<uint16_t>(std::istream& is, std::string name); - -template<> -uint32_t parse<uint32_t>(std::istream& is, std::string name); - -template<> -Magic16 parse<Magic16>(std::istream& is, std::string name); - -template<> -Value16 parse<Value16>(std::istream& is, std::string name); - -template<> -Offset16 parse<Offset16>(std::istream& is, std::string name); - -template<> -Value32 parse<Value32>(std::istream& is, std::string name); - -template<> -Offset32 parse<Offset32>(std::istream& is, std::string name); - -template<> -std::array<uint8_t, 8> parse<std::array<uint8_t, 8>>(std::istream& is, std::string name); - -template<> -std::array<uint8_t, 22> parse<std::array<uint8_t, 22>>(std::istream& is, std::string name); - -void dump_bytes(std::istream& is, std::vector<uint8_t>& buffer, std::string name); - -std::string to_string(Magic16 magic); - -//overload inside this namespace to output unsigned char as value not as characters. -std::ostream& operator<<(std::ostream& os, uint8_t); - -std::ostream& operator<<(std::ostream& os, Value8 v); -std::ostream& operator<<(std::ostream& os, Offset8 o); - -std::ostream& operator<<(std::ostream& os, Magic16 m); -std::ostream& operator<<(std::ostream& os, Value16 v); -std::ostream& operator<<(std::ostream& os, Offset16 o); - -std::ostream& operator<<(std::ostream& os, Value32 v); -std::ostream& operator<<(std::ostream& os, Offset32 o); - -}
\ No newline at end of file |
