void save_override( const ::boost::serialization::nvp< T > & t ){ save_start(t.name()); archive::save(* this->This(), t.const_value()); save_end(t.name()); }
void load_override( const boost::serialization::nvp< T > & t ){ load_start(t.name()); archive::load(* this->This(), t.value()); load_end(t.name()); }
void load_override(const boost::serialization::nvp< std::vector<value_type, allocator_type> > data, int) { token type = input.type(); if (type == token_array_begin) { scope_stack.push(scope(type)); input.next(); while (true) { type = input.type(); if (type == token_array_end) { if (scope_stack.top().group == token_array_begin) { scope_stack.pop(); } else { goto error; } break; } else if ((type == token_eof) || (type == token_error)) { goto error; } else { value_type item; *this >> boost::serialization::make_nvp(data.name(), item); data.value().push_back(item); } } }
void ws_xml_iarchive::load_override( #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif boost::serialization::nvp< bool > & t, int){ std::string str; base::load_override(boost::serialization::make_nvp<std::string>(t.name(), str), 0); t.value() = (str == "true"); }
void save_override( #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif ::boost::serialization::nvp<T> & t, int ){ save_start(t.name()); archive::save(* this->This(), t.const_value()); save_end(t.name()); }
void load_override( #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif boost::serialization::nvp<T> & t, int ){ load_start(t.name()); archive::load(* this->This(), t.value()); load_end(t.name()); }
void load_override( #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif boost::serialization::nvp<T> & t, int ){ this->This()->load_start(t.name()); this->detail_common_iarchive::load_override(t.value(), 0); this->This()->load_end(t.name()); }
void save_override( #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif ::boost::serialization::nvp<T> & t, int ){ this->This()->save_start(t.name()); this->detail_common_oarchive::save_override(t.const_value(), 0); this->This()->save_end(t.name()); }
void operator () (Archive& ar, const boost::serialization::nvp<T>& data, const unsigned int version) { // Drop the name ar << data.value(); }
void load_override( #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif boost::serialization::nvp< boost::serialization::collection_size_type > &t, int ) { std::string itemName = m_currentName; std::string cap; unsigned counter = 0; m_collectionStart = true; m_collectionEnd = false; m_collectionStream << "<item_version>0</item_version>"; while (true) { *this >> boost::serialization::make_nvp(itemName.c_str(), cap); if (m_collectionEnd) break; m_collectionStream << "<item>" << cap << "</item>"; counter++; } t.value() = counter; m_collectionSize = counter + 1; // +1 as the same loop sequence will parse item_version m_collection = std::make_unique<ws_xml_iarchive>(m_collectionStream); }
void load_override( #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif boost::serialization::nvp< T > &t, int ) { if (m_collectionSize) { // Delegate to inner collection m_collection->load_override(t,0); if (!--m_collectionSize) { m_collection = nullptr; } return; } std::streampos lastPos = is.tellg(); m_currentName = t.name(); // std::cerr << m_currentName << " [" << char(is.peek()) << "] [" << int(is.tellg())<< ']' <<std::endl; if (!m_collectionStart) { bool startLoaded = this->This()->load_start(t.name(), true); if (!startLoaded) { // Retrace a bit and signal a collection end is.seekg(lastPos - std::streampos(m_currentName.size()) - 3); m_collectionEnd = true; return; } } else { m_collectionStart = false; } boost::archive::load(* this->This(), t.value()); this->This()->load_end(t.name()); }
void load_override(const boost::serialization::nvp<T> & t, int){ T& x(t.value()); * this >> x; }
void load_override(const boost::serialization::nvp<boost::serialization::collection_size_type> & t, int){ size_t x=0; * this >> x; t.value() = boost::serialization::collection_size_type(x); }
void json_iarchive::load_override(boost::serialization::nvp<boost::serialization::collection_size_type> const& t, int) { load_override(t.value(), 0); }