Last change
on this file since 33 was
29,
checked in by landauf, 17 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
1.1 KB
|
Line | |
---|
1 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
---|
2 | // |
---|
3 | // demo_xml_load.cpp |
---|
4 | // |
---|
5 | // (C) Copyright 2002-4 Robert Ramey - http://www.rrsd.com . |
---|
6 | // Use, modification and distribution is subject to the Boost Software |
---|
7 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
---|
8 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
9 | |
---|
10 | #include <iostream> |
---|
11 | #include <string> |
---|
12 | #include <boost/archive/tmpdir.hpp> |
---|
13 | |
---|
14 | #include <boost/archive/xml_iarchive.hpp> |
---|
15 | |
---|
16 | #include "demo_xml.hpp" |
---|
17 | |
---|
18 | void |
---|
19 | restore_schedule(bus_schedule &s, const char * filename) |
---|
20 | { |
---|
21 | // open the archive |
---|
22 | std::ifstream ifs(filename); |
---|
23 | assert(ifs.good()); |
---|
24 | boost::archive::xml_iarchive ia(ifs); |
---|
25 | |
---|
26 | // restore the schedule from the archive |
---|
27 | ia >> BOOST_SERIALIZATION_NVP(s); |
---|
28 | } |
---|
29 | |
---|
30 | int main(int argc, char *argv[]) |
---|
31 | { |
---|
32 | // make a new schedule |
---|
33 | bus_schedule new_schedule; |
---|
34 | |
---|
35 | std::string filename(boost::archive::tmpdir()); |
---|
36 | filename += "/demo_save.xml"; |
---|
37 | |
---|
38 | restore_schedule(new_schedule, filename.c_str()); |
---|
39 | |
---|
40 | // and display |
---|
41 | std::cout << "\nrestored schedule"; |
---|
42 | std::cout << new_schedule; |
---|
43 | |
---|
44 | return 0; |
---|
45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.