]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/quickbook/src/state.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / quickbook / src / state.hpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Copyright (c) 2002 2004 2006 Joel de Guzman
3 Copyright (c) 2004 Eric Niebler
4 http://spirit.sourceforge.net/
5
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#if !defined(BOOST_SPIRIT_ACTIONS_CLASS_HPP)
11#define BOOST_SPIRIT_ACTIONS_CLASS_HPP
12
13#include <map>
14#include <boost/scoped_ptr.hpp>
15#include "parsers.hpp"
16#include "values_parse.hpp"
17#include "collector.hpp"
18#include "template_stack.hpp"
19#include "symbols.hpp"
20#include "dependency_tracker.hpp"
21#include "syntax_highlight.hpp"
22#include "include_paths.hpp"
23
24namespace quickbook
25{
26 namespace cl = boost::spirit::classic;
27 namespace fs = boost::filesystem;
28
29 struct state
30 {
31 state(fs::path const& filein_, fs::path const& xinclude_base, string_stream& out_,
32 document_state&);
33
34 private:
35 boost::scoped_ptr<quickbook_grammar> grammar_;
36
37 public:
38 ///////////////////////////////////////////////////////////////////////////
39 // State
40 ///////////////////////////////////////////////////////////////////////////
41
42 typedef std::vector<std::string> string_list;
43
44 static int const max_template_depth = 100;
45
46 // global state
47 unsigned order_pos;
48 fs::path xinclude_base;
49 template_stack templates;
50 int error_count;
51 string_list anchors;
52 bool warned_about_breaks;
53 bool conditional;
54 document_state& document;
55 value_builder callouts; // callouts are global as
56 int callout_depth; // they don't nest.
57 dependency_tracker dependencies;
58 bool explicit_list; // set when using a list
b32b8144 59 bool strict_mode;
7c673cae
FG
60
61 // state saved for files and templates.
62 bool imported;
63 string_symbols macro;
64 source_mode_info source_mode;
65 source_mode_type source_mode_next;
66 value source_mode_next_pos;
67 std::vector<source_mode_info>
68 tagged_source_mode_stack;
69 file_ptr current_file;
70 quickbook_path current_path;
71
72 // state saved for templates.
73 int template_depth;
74 int min_section_level;
75
76 // output state - scoped by templates and grammar
77 bool in_list; // generating a list
78 std::stack<bool> in_list_save; // save the in_list state
7c673cae
FG
79 collector out; // main output stream
80 collector phrase; // phrase output stream
81
82 // values state - scoped by everything.
83 value_parser values; // parsed values
84
85 quickbook_grammar& grammar() const;
86
87 ///////////////////////////////////////////////////////////////////////////
88 // actions
89 ///////////////////////////////////////////////////////////////////////////
90
91 void update_filename_macro();
92
93 unsigned get_new_order_pos();
94
95 void push_output();
96 void pop_output();
97
98 void start_list(char mark);
99 void end_list(char mark);
100 void start_list_item();
101 void end_list_item();
102
103 void start_callouts();
104 std::string add_callout(value);
105 std::string end_callouts();
106
107 source_mode_info current_source_mode() const;
108 source_mode_info tagged_source_mode() const;
109 void change_source_mode(source_mode_type);
110 void push_tagged_source_mode(source_mode_type);
111 void pop_tagged_source_mode();
112 };
113
114 extern unsigned qbk_version_n; // qbk_major_version * 100 + qbk_minor_version
115 extern char const* quickbook_get_date;
116 extern char const* quickbook_get_time;
117}
118
119#endif // BOOST_SPIRIT_ACTIONS_CLASS_HPP