]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/quickbook/src/syntax_highlight.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / quickbook / src / syntax_highlight.hpp
1 /*=============================================================================
2 Copyright (c) 2011,2013 Daniel James
3
4 Use, modification and distribution is subject to the Boost Software
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
8
9 #if !defined(BOOST_QUICKBOOK_SYNTAX_HIGHLIGHT_HPP)
10 #define BOOST_QUICKBOOK_SYNTAX_HIGHLIGHT_HPP
11
12 #include "fwd.hpp"
13 #include "phrase_tags.hpp"
14 #include "iterator.hpp"
15 #include <boost/swap.hpp>
16
17 namespace quickbook
18 {
19 //
20 // source_mode_info
21 //
22 // The source mode is stored in a few places, so the order needs to also be
23 // stored to work out which is the current source mode.
24
25 struct source_mode_info {
26 source_mode_type source_mode;
27 unsigned order;
28
29 source_mode_info() : source_mode(source_mode_tags::cpp), order(0) {}
30
31 source_mode_info(source_mode_type source_mode_, unsigned order_) :
32 source_mode(source_mode_),
33 order(order_) {}
34
35 void update(source_mode_info const& x) {
36 if (x.order > order) {
37 source_mode = x.source_mode;
38 order = x.order;
39 }
40 }
41
42 void swap(source_mode_info& x) {
43 boost::swap(source_mode, x.source_mode);
44 boost::swap(order, x.order);
45 }
46 };
47
48 inline void swap(source_mode_info& x, source_mode_info& y) {
49 x.swap(y);
50 }
51
52 void syntax_highlight(
53 parse_iterator first, parse_iterator last,
54 quickbook::state& state,
55 source_mode_type source_mode,
56 bool is_block);
57 }
58
59 #endif