-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathrp_unresolved_reporter.hpp
More file actions
119 lines (93 loc) · 2.6 KB
/
rp_unresolved_reporter.hpp
File metadata and controls
119 lines (93 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#pragma once
#include "reporter/impl/rp_base_reporter_impl.hpp"
#include <functional>
//------------------------------------------------------------------------------
namespace model_includes {
class Include;
class File;
}
//------------------------------------------------------------------------------
namespace reporter {
//------------------------------------------------------------------------------
class UnresolvedReporter final : public BaseReporterImpl
{
public:
void report(
const model_includes::Model & _model,
std::ostream & _stream
) override;
ReporterKind getKind() const override;
private:
class SourceOrder
{
public:
bool operator()(
const model_includes::Include * _r,
const model_includes::Include * _l
) const;
};
using UnorderedIncludes = stdfwd::vector< const model_includes::Include * >;
using OrderedIncludes = stdfwd::set<
const model_includes::Include *,
SourceOrder
>;
using UnorderedIncludesByDestination = stdfwd::unordered_map<
const model_includes::File *,
UnorderedIncludes
>;
struct DestinationFileInfo
{
const model_includes::File * m_file;
std::size_t m_count;
};
class DestinationFileInfoorder
{
public:
bool operator()(
const DestinationFileInfo & _r,
const DestinationFileInfo & _l
) const;
};
using DestinationFileByCount = stdfwd::set<
DestinationFileInfo,
DestinationFileInfoorder
>;
void collectIncludes(
const model_includes::Model & _model,
UnorderedIncludesByDestination & _unorderedIncludes
) const;
static DestinationFileByCount orderDestinationByCount(
const UnorderedIncludesByDestination & _unorderedIncludes
);
bool isUnresolvedInclude( const model_includes::Include & _include ) const;
void report(
const UnorderedIncludesByDestination & _unorderedIncludesByDestination,
const DestinationFileByCount & _destinationFileByCount,
const std::filesystem::path & _projectDir,
std::ostream & _stream
) const;
void report(
const model_includes::Include & _include,
const std::filesystem::path & _projectDir,
std::ostream & _stream
) const;
void reportDestinationFile(
const model_includes::File & _file,
size_t _number,
const std::filesystem::path & _projectDir,
std::ostream & _stream
) const;
void reportSourceFiles(
const UnorderedIncludes & _includes,
const std::filesystem::path & _projectDir,
std::ostream & _stream
) const;
void reportSourceFile(
const model_includes::Include & _include,
size_t _number,
const std::filesystem::path & _projectDir,
std::ostream & _stream
) const;
};
//------------------------------------------------------------------------------
}