| Line | |
|---|
| 1 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
|---|
| 2 | // test_non_serializable.cpp: test implementation level trait |
|---|
| 3 | |
|---|
| 4 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . |
|---|
| 5 | // Use, modification and distribution is subject to the Boost Software |
|---|
| 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
|---|
| 7 | // http://www.boost.org/LICENSE_1_0.txt) |
|---|
| 8 | |
|---|
| 9 | // test implementation level "not_serializable" |
|---|
| 10 | // should fail compilation |
|---|
| 11 | |
|---|
| 12 | #include <fstream> |
|---|
| 13 | |
|---|
| 14 | #include "test_tools.hpp" |
|---|
| 15 | #include <boost/preprocessor/stringize.hpp> |
|---|
| 16 | #include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) |
|---|
| 17 | #include <boost/serialization/level.hpp> |
|---|
| 18 | #include <boost/serialization/nvp.hpp> |
|---|
| 19 | |
|---|
| 20 | class A |
|---|
| 21 | { |
|---|
| 22 | }; |
|---|
| 23 | |
|---|
| 24 | BOOST_CLASS_IMPLEMENTATION(A, boost::serialization::not_serializable) |
|---|
| 25 | |
|---|
| 26 | void out(A & a) |
|---|
| 27 | { |
|---|
| 28 | test_ostream os("testfile", TEST_STREAM_FLAGS); |
|---|
| 29 | test_oarchive oa(os); |
|---|
| 30 | oa << BOOST_SERIALIZATION_NVP(a); |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | void in(A & a) |
|---|
| 34 | { |
|---|
| 35 | test_istream is("testfile", TEST_STREAM_FLAGS); |
|---|
| 36 | test_iarchive ia(is); |
|---|
| 37 | ia >> BOOST_SERIALIZATION_NVP(a); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | int |
|---|
| 41 | test_main( int /* argc */, char* /* argv */[] ) |
|---|
| 42 | { |
|---|
| 43 | A a; |
|---|
| 44 | out(a); |
|---|
| 45 | in(a); |
|---|
| 46 | return EXIT_SUCCESS; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | // EOF |
|---|
Note: See
TracBrowser
for help on using the repository browser.