From a7bcede17b4c10e172c7877fc2ce89862dc454af Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Thu, 23 Jun 2016 18:07:42 +0200 Subject: adds alot more binary parsing. --- binparse/parse.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'binparse/parse.cpp') diff --git a/binparse/parse.cpp b/binparse/parse.cpp index cf7c0be..a26e72e 100644 --- a/binparse/parse.cpp +++ b/binparse/parse.cpp @@ -89,6 +89,14 @@ Offset32 parse(std::istream& is, std::string name) { return Offset32(parse(is, name)); } +template<> +PString8 parse(std::istream& is, std::string name) { + uint8_t len = parse(is, name + "_len"); + std::vector data(len, 0); + is.read(data.data(), len); + return PString8(std::string(data.begin(), data.end())); +} + template<> std::array parse>(std::istream& is, std::string name) { if(!is) { -- cgit v1.2.3-70-g09d2