summaryrefslogtreecommitdiff
path: root/binparse/parse.cpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-06-23 18:07:42 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-06-23 18:07:42 +0200
commita7bcede17b4c10e172c7877fc2ce89862dc454af (patch)
treed89b8ff274d18d67d695c5f320a1d079e1bb26b6 /binparse/parse.cpp
parent0f2d7c9ed9dfa3716840fc112bd53e5ec6b6315b (diff)
downloadopenwar-a7bcede17b4c10e172c7877fc2ce89862dc454af.tar.gz
openwar-a7bcede17b4c10e172c7877fc2ce89862dc454af.tar.bz2
openwar-a7bcede17b4c10e172c7877fc2ce89862dc454af.zip
adds alot more binary parsing.
Diffstat (limited to 'binparse/parse.cpp')
-rw-r--r--binparse/parse.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/binparse/parse.cpp b/binparse/parse.cpp
index cf7c0be..a26e72e 100644
--- a/binparse/parse.cpp
+++ b/binparse/parse.cpp
@@ -90,6 +90,14 @@ Offset32 parse<Offset32>(std::istream& is, std::string name) {
}
template<>
+PString8 parse<PString8>(std::istream& is, std::string name) {
+ uint8_t len = parse<uint8_t>(is, name + "_len");
+ std::vector<char> data(len, 0);
+ is.read(data.data(), len);
+ return PString8(std::string(data.begin(), data.end()));
+}
+
+template<>
std::array<uint8_t, 8> parse<std::array<uint8_t, 8>>(std::istream& is, std::string name) {
if(!is) {
throw UnexpectedEOS();