]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_DOCUMENT_STATE_HPP) | |
10 | #define BOOST_QUICKBOOK_DOCUMENT_STATE_HPP | |
11 | ||
12 | #include <boost/scoped_ptr.hpp> | |
b32b8144 | 13 | #include "string_view.hpp" |
7c673cae FG |
14 | #include <string> |
15 | #include "values.hpp" | |
16 | #include "syntax_highlight.hpp" | |
17 | ||
18 | namespace quickbook | |
19 | { | |
20 | // id_category | |
21 | // | |
22 | // Higher categories get priority over lower ones. | |
23 | ||
24 | struct id_category | |
25 | { | |
26 | enum categories | |
27 | { | |
28 | default_category = 0, | |
29 | numbered, // Just used to avoid random docbook ids | |
30 | generated, // Generated ids for other elements. | |
31 | generated_heading, // Generated ids for headings. | |
32 | generated_section, // Generated ids for sections. | |
33 | generated_doc, // Generated ids for document. | |
34 | explicit_id, // Explicitly given by user | |
35 | explicit_section_id, | |
36 | explicit_anchor_id | |
37 | }; | |
38 | ||
39 | id_category() : c(default_category) {} | |
b32b8144 FG |
40 | id_category(categories c_) : c(c_) {} |
41 | explicit id_category(int c_) : c(categories(c_)) {} | |
7c673cae FG |
42 | |
43 | bool operator==(id_category rhs) const { return c == rhs.c; } | |
44 | ||
45 | categories c; | |
46 | }; | |
47 | ||
48 | struct document_state_impl; | |
49 | ||
50 | struct document_state | |
51 | { | |
52 | document_state(); | |
53 | ~document_state(); | |
54 | ||
55 | std::string start_file_with_docinfo( | |
56 | unsigned compatibility_version, | |
b32b8144 FG |
57 | quickbook::string_view include_doc_id, |
58 | quickbook::string_view id, | |
7c673cae FG |
59 | value const& title); |
60 | ||
61 | void start_file( | |
62 | unsigned compatibility_version, | |
b32b8144 FG |
63 | quickbook::string_view include_doc_id, |
64 | quickbook::string_view id, | |
7c673cae FG |
65 | value const& title); |
66 | ||
67 | void end_file(); | |
68 | ||
b32b8144 FG |
69 | std::string begin_section(value const&, |
70 | quickbook::string_view, id_category, source_mode_info const&); | |
7c673cae FG |
71 | void end_section(); |
72 | int section_level() const; | |
b32b8144 | 73 | value const& explicit_id() const; |
7c673cae FG |
74 | source_mode_info section_source_mode() const; |
75 | ||
b32b8144 FG |
76 | std::string old_style_id(quickbook::string_view, id_category); |
77 | std::string add_id(quickbook::string_view, id_category); | |
78 | std::string add_anchor(quickbook::string_view, id_category); | |
7c673cae FG |
79 | |
80 | std::string replace_placeholders_with_unresolved_ids( | |
b32b8144 FG |
81 | quickbook::string_view) const; |
82 | std::string replace_placeholders(quickbook::string_view) const; | |
7c673cae FG |
83 | |
84 | unsigned compatibility_version() const; | |
85 | private: | |
86 | boost::scoped_ptr<document_state_impl> state; | |
87 | }; | |
88 | } | |
89 | ||
90 | #endif |