From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- .../libs/serialization/example/demo_xml_load.cpp | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/boost/libs/serialization/example/demo_xml_load.cpp (limited to 'src/boost/libs/serialization/example/demo_xml_load.cpp') diff --git a/src/boost/libs/serialization/example/demo_xml_load.cpp b/src/boost/libs/serialization/example/demo_xml_load.cpp new file mode 100644 index 000000000..fcbe80bbf --- /dev/null +++ b/src/boost/libs/serialization/example/demo_xml_load.cpp @@ -0,0 +1,45 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// +// demo_xml_load.cpp +// +// (C) Copyright 2002-4 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#include + +#include "demo_gps.hpp" + +void +restore_schedule(bus_schedule &s, const char * filename) +{ + // open the archive + std::ifstream ifs(filename); + assert(ifs.good()); + boost::archive::xml_iarchive ia(ifs); + + // restore the schedule from the archive + ia >> BOOST_SERIALIZATION_NVP(s); +} + +int main(int argc, char *argv[]) +{ + // make a new schedule + bus_schedule new_schedule; + + std::string filename(boost::archive::tmpdir()); + filename += "/demo_save.xml"; + + restore_schedule(new_schedule, filename.c_str()); + + // and display + std::cout << "\nrestored schedule"; + std::cout << new_schedule; + + return 0; +} -- cgit v1.2.3