]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2002 2004 2006 Joel de Guzman | |
3 | Copyright (c) 2004 Eric Niebler | |
4 | Copyright (c) 2005 Thomas Guest | |
5 | Copyright (c) 2013 Daniel James | |
6 | ||
7 | Use, modification and distribution is subject to the Boost Software | |
8 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
9 | http://www.boost.org/LICENSE_1_0.txt) | |
10 | =============================================================================*/ | |
11 | ||
12 | #if !defined(BOOST_QUICKBOOK_INCLUDE_PATHS_HPP) | |
13 | #define BOOST_QUICKBOOK_INCLUDE_PATHS_HPP | |
14 | ||
15 | // Classes and functions for dealing with the values from include, import and | |
16 | // xinclude elements. | |
17 | ||
18 | #include "fwd.hpp" | |
19 | #include "values.hpp" | |
20 | #include <set> | |
21 | #include <string> | |
22 | #include <boost/filesystem/path.hpp> | |
23 | ||
24 | namespace quickbook | |
25 | { | |
26 | struct path_parameter { | |
27 | // Will possibly add 'url' to this list later: | |
28 | enum path_type { invalid, path, glob }; | |
29 | ||
30 | std::string value; | |
31 | path_type type; | |
32 | ||
b32b8144 FG |
33 | path_parameter(std::string const& value_, path_type type_) : |
34 | value(value_), type(type_) {} | |
7c673cae FG |
35 | }; |
36 | ||
37 | path_parameter check_path(value const& path, quickbook::state& state); | |
38 | path_parameter check_xinclude_path(value const&, quickbook::state&); | |
39 | ||
40 | struct quickbook_path | |
41 | { | |
42 | quickbook_path(fs::path const& x, unsigned offset, fs::path const& y) | |
43 | : file_path(x), include_path_offset(offset), abstract_file_path(y) {} | |
44 | ||
45 | friend void swap(quickbook_path&, quickbook_path&); | |
46 | ||
47 | quickbook_path parent_path() const; | |
48 | ||
49 | bool operator<(quickbook_path const& other) const; | |
b32b8144 FG |
50 | quickbook_path operator/(quickbook::string_view) const; |
51 | quickbook_path& operator/=(quickbook::string_view); | |
7c673cae FG |
52 | |
53 | // The actual location of the file. | |
54 | fs::path file_path; | |
55 | ||
56 | // The member of the include path that this file is relative to. | |
57 | // (1-indexed, 0 == original quickbook file) | |
58 | unsigned include_path_offset; | |
59 | ||
60 | // A machine independent representation of the file's | |
61 | // path - not unique per-file | |
62 | fs::path abstract_file_path; | |
63 | }; | |
64 | ||
65 | std::set<quickbook_path> include_search(path_parameter const&, | |
66 | quickbook::state& state, string_iterator pos); | |
67 | ||
b32b8144 | 68 | quickbook_path resolve_xinclude_path(std::string const&, quickbook::state&, bool is_file = false); |
7c673cae FG |
69 | } |
70 | ||
71 | #endif |