]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/quickbook/src/syntax_highlight.hpp
12b3a63ae07152cda407605d3eb3ea32295e5f08
[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 <boost/swap.hpp>
15
16 namespace quickbook
17 {
18 //
19 // source_mode_info
20 //
21 // The source mode is stored in a few places, so the order needs to also be
22 // stored to work out which is the current source mode.
23
24 struct source_mode_info {
25 source_mode_type source_mode;
26 unsigned order;
27
28 source_mode_info() : source_mode(source_mode_tags::cpp), order(0) {}
29
30 source_mode_info(source_mode_type source_mode, unsigned order) :
31 source_mode(source_mode),
32 order(order) {}
33
34 void update(source_mode_info const& x) {
35 if (x.order > order) {
36 source_mode = x.source_mode;
37 order = x.order;
38 }
39 }
40
41 void swap(source_mode_info& x) {
42 boost::swap(source_mode, x.source_mode);
43 boost::swap(order, x.order);
44 }
45 };
46
47 inline void swap(source_mode_info& x, source_mode_info& y) {
48 x.swap(y);
49 }
50
51 void syntax_highlight(
52 parse_iterator first, parse_iterator last,
53 quickbook::state& state,
54 source_mode_type source_mode,
55 bool is_block);
56 }
57
58 #endif