]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // examples/serialise.hpp |
2 | // Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/) | |
3 | // | |
4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | #ifndef BOOST_LEXER_SERIALISE_HPP | |
7 | #define BOOST_LEXER_SERIALISE_HPP | |
8 | ||
9 | #include "internals.hpp" | |
10 | #include "state_machine.hpp" | |
11 | #include <boost/serialization/vector.hpp> | |
12 | ||
13 | namespace boost | |
14 | { | |
15 | namespace lexer | |
16 | { | |
17 | // IMPORTANT! This won't work if you don't enable RTTI! | |
18 | template<typename CharT, class Archive> | |
19 | void serialise (basic_state_machine<CharT> &sm_, Archive &ar_, | |
20 | unsigned int version_ = 1) | |
21 | { | |
22 | detail::internals &internals_ = const_cast<detail::internals &> | |
23 | (sm_.data ()); | |
24 | ||
25 | ar_ & version_; | |
26 | ar_ & *internals_._lookup; | |
27 | ar_ & internals_._dfa_alphabet; | |
28 | ar_ & *internals_._dfa; | |
29 | ar_ & internals_._seen_BOL_assertion; | |
30 | ar_ & internals_._seen_EOL_assertion; | |
31 | } | |
32 | } | |
33 | } | |
34 | ||
35 | #endif |