From d982b54bda3ab038201b819df211800f8ea2b0a2 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 11:05:04 -0500 Subject: [PATCH] byte_stream: Remove template specialization in class scope --- src/xenia/base/byte_stream.cc | 20 ++++++++++++++++++++ src/xenia/base/byte_stream.h | 28 +++++++--------------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/xenia/base/byte_stream.cc b/src/xenia/base/byte_stream.cc index 98599e02b..652b5c0df 100644 --- a/src/xenia/base/byte_stream.cc +++ b/src/xenia/base/byte_stream.cc @@ -36,4 +36,24 @@ void ByteStream::Write(const uint8_t* buf, size_t len) { Advance(len); } +template <> +std::string ByteStream::Read() { + std::string str; + uint32_t len = Read(); + str.resize(len); + + Read(reinterpret_cast(&str[0]), len); + return str; +} + +template <> +std::wstring ByteStream::Read() { + std::wstring str; + uint32_t len = Read(); + str.resize(len); + + Read(reinterpret_cast(&str[0]), len * 2); + return str; +} + } // namespace xe diff --git a/src/xenia/base/byte_stream.h b/src/xenia/base/byte_stream.h index 479be9760..d97568b28 100644 --- a/src/xenia/base/byte_stream.h +++ b/src/xenia/base/byte_stream.h @@ -46,26 +46,6 @@ class ByteStream { return data; } - template <> - std::string Read() { - std::string str; - uint32_t len = Read(); - str.resize(len); - - Read(reinterpret_cast(&str[0]), len); - return str; - } - - template <> - std::wstring Read() { - std::wstring str; - uint32_t len = Read(); - str.resize(len); - - Read(reinterpret_cast(&str[0]), len * 2); - return str; - } - template void Write(T data) { Write(reinterpret_cast(&data), sizeof(T)); @@ -87,6 +67,12 @@ class ByteStream { size_t offset_ = 0; }; +template <> +std::string ByteStream::Read(); + +template <> +std::wstring ByteStream::Read(); + } // namespace xe -#endif // XENIA_BASE_BYTE_STREAM_H_ \ No newline at end of file +#endif // XENIA_BASE_BYTE_STREAM_H_