diff options
| author | Pieter Wuille <[email protected]> | 2020-03-11 09:35:50 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2020-03-30 16:10:30 -0700 |
| commit | 4eb5643e3538863c9d2ff261f49a9a1b248de243 (patch) | |
| tree | 377437ffee20c67fa7e0611c31be6b2490a4483c /src/test/dbwrapper_tests.cpp | |
| parent | Convert blockencodings_tests to new serialization (diff) | |
| download | discoin-4eb5643e3538863c9d2ff261f49a9a1b248de243.tar.xz discoin-4eb5643e3538863c9d2ff261f49a9a1b248de243.zip | |
Convert everything except wallet/qt to new serialization
Diffstat (limited to 'src/test/dbwrapper_tests.cpp')
| -rw-r--r-- | src/test/dbwrapper_tests.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/test/dbwrapper_tests.cpp b/src/test/dbwrapper_tests.cpp index 3dfae29de..526e5f4c2 100644 --- a/src/test/dbwrapper_tests.cpp +++ b/src/test/dbwrapper_tests.cpp @@ -331,24 +331,26 @@ struct StringContentsSerializer { } StringContentsSerializer& operator+=(const StringContentsSerializer& s) { return *this += s.str; } - ADD_SERIALIZE_METHODS; - - template <typename Stream, typename Operation> - inline void SerializationOp(Stream& s, Operation ser_action) { - if (ser_action.ForRead()) { - str.clear(); - char c = 0; - while (true) { - try { - READWRITE(c); - str.push_back(c); - } catch (const std::ios_base::failure&) { - break; - } + template<typename Stream> + void Serialize(Stream& s) const + { + for (size_t i = 0; i < str.size(); i++) { + s << str[i]; + } + } + + template<typename Stream> + void Unserialize(Stream& s) + { + str.clear(); + char c = 0; + while (true) { + try { + s >> c; + str.push_back(c); + } catch (const std::ios_base::failure&) { + break; } - } else { - for (size_t i = 0; i < str.size(); i++) - READWRITE(str[i]); } } }; |