1#ifndef TATOOINE_GL_INCLUDE_TREE_H
2#define TATOOINE_GL_INCLUDE_TREE_H
37 std::filesystem::path
const&
path,
47 std::filesystem::path
const&
path,
55 std::filesystem::path
const&
path)
68 auto parse_line(std::size_t n)
const -> std::pair<include_tree const&, std::size_t> {
69 auto cur_offset = std::size_t{};
71 auto const line_number =
static_cast<std::size_t
>(nesting.m_line_number);
73 n <
line_number + cur_offset + nesting.num_lines_with_includes()) {
74 return nesting.parse_line(n - cur_offset -
line_number);
76 cur_offset += nesting.num_lines_with_includes() - 1;
79 return {*
this, n - cur_offset};
86 n += nesting.num_lines_with_includes();
90 auto print(std::size_t indent = 0) const ->
void {
91 for (std::size_t i = 0; i < indent; ++i) {
97 nesting.print(indent + 2);
Definition: ansiformat.h:6
Definition: includetree.h:11
auto num_lines() const
Definition: includetree.h:22
auto has_parent() const -> bool
Definition: includetree.h:31
include_tree const * m_parent
Definition: includetree.h:17
include_tree()
Definition: includetree.h:34
auto parse_line(std::size_t n) const -> std::pair< include_tree const &, std::size_t >
returns file and line number
Definition: includetree.h:68
include_tree(std::size_t line_number, std::size_t num_lines, std::filesystem::path const &path)
Definition: includetree.h:54
include_tree(std::size_t line_number, std::size_t num_lines, std::filesystem::path const &path, include_tree const &parent)
Definition: includetree.h:60
auto path() const -> auto const &
Definition: includetree.h:24
auto parent() const -> auto const &
Definition: includetree.h:30
auto nested_include_trees() -> auto &
Definition: includetree.h:29
auto line_number() const
Definition: includetree.h:20
include_tree(std::size_t line_number, std::size_t num_lines, std::filesystem::path const &path, std::list< include_tree > const &nested_include_trees, include_tree const &parent)
Definition: includetree.h:36
auto nested_include_trees() const -> auto const &
Definition: includetree.h:26
int m_line_number
Definition: includetree.h:13
std::filesystem::path m_path
Definition: includetree.h:15
auto num_lines_with_includes() const -> std::size_t
Definition: includetree.h:82
auto path() -> auto &
Definition: includetree.h:25
std::size_t m_num_lines
Definition: includetree.h:14
auto print(std::size_t indent=0) const -> void
Definition: includetree.h:90
include_tree(std::size_t line_number, std::size_t num_lines, std::filesystem::path const &path, std::list< include_tree > const &nested_include_trees)
Definition: includetree.h:46
auto num_lines() -> auto &
Definition: includetree.h:23
std::list< include_tree > m_nested_include_trees
Definition: includetree.h:16
auto line_number() -> auto &
Definition: includetree.h:21