-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmi_analyzer_impl.hpp
More file actions
101 lines (73 loc) · 2.4 KB
/
mi_analyzer_impl.hpp
File metadata and controls
101 lines (73 loc) · 2.4 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
#pragma once
#include "model_includes/api/mi_analyzer.hpp"
#include <std_fs>
#include <stdfwd/vector>
#include <memory>
//------------------------------------------------------------------------------
namespace fs
{
class FileSystem;
}
//------------------------------------------------------------------------------
namespace parser
{
class Parser;
class IncludeFile;
}
//------------------------------------------------------------------------------
namespace model_includes
{
class Model;
class File;
class Include;
class AnalyzerContext;
class Resolver;
enum class FileType;
enum class IncludeType;
enum class IncludeStatus;
//------------------------------------------------------------------------------
class AnalyzerImpl final : public Analyzer
{
public:
AnalyzerImpl( const fs::FileSystem & _fs, const parser::Parser & _parser );
ModelPtr analyze( const project::Project & _project ) const override;
ModelPtr analyze(
const project::Project & _project,
const cmake_project::Project & _cmakeProject ) const override;
private:
using Path = stdfs::path;
using IncludeFiles = stdfwd::vector< parser::IncludeFile >;
static ModelPtr initModel( const project::Project & _project );
void
analyzeFolder( AnalyzerContext & _context, const Path & _folderPath ) const;
void analyzeFile( AnalyzerContext & _context, const Path & _path ) const;
void analyzeIncludeFiles(
AnalyzerContext & _context,
const Path & _path,
const IncludeFiles & _includesFile ) const;
void analyzeIncludeFile(
AnalyzerContext & _context,
const Path & _path,
const parser::IncludeFile & _includeFile,
File & _file ) const;
static void postProcesNewInclude(
AnalyzerContext & _context, const model_includes::Include & _include );
const Path & getProjectDir() const;
using ResolvedPath = std::pair< Path, bool >;
ResolvedPath resolvePath(
const AnalyzerContext & _context,
const Path & _currentFile,
const parser::IncludeFile & _includeFile ) const;
FileType getFileType( const Path & _path ) const;
IncludeType
getIncludeType( const parser::IncludeFile & _includesFile ) const;
IncludeStatus
getIncludeStatus( const File & _file, const ResolvedPath & _pair ) const;
Resolver & ensureResolver() const;
private:
const fs::FileSystem & m_fs;
const parser::Parser & m_parser;
mutable std::unique_ptr< Resolver > m_resolver;
};
//------------------------------------------------------------------------------
}