#pragma once #include "xtr/core/rslIndex.hpp" namespace xtr::io { //! MFC serialization adapter for CCL class CArchiveAdapter { public: CArchiveAdapter(CArchive& ar) noexcept : archive{ ar } {} private: CArchive& archive; public: CArchive& get() noexcept { return archive; } bool IsStoring() const { return archive.IsStoring(); } template CArchiveAdapter& operator>>(Object& obj) { archive >> obj; return *this; } template<> CArchiveAdapter& operator>>(std::string& obj) { CString str{}; archive >> str; index::FixLegacy(str); obj = mfc::ToSTL(str); return *this; } CArchiveAdapter& operator>>(std::u8string& obj) { CString str{}; archive >> str; index::FixLegacy(str); obj = mfc::ToUTF8(str); return *this; } template void Skip() { Object discard{}; *this >> discard; } template void SkipN(uint32_t count) { while (count--) { Skip(); } } template Object Load() { Object obj{}; *this >> obj; return obj; } }; } // namespace xtr::io