-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcprj_project_impl.cpp
More file actions
84 lines (62 loc) · 1.94 KB
/
cprj_project_impl.cpp
File metadata and controls
84 lines (62 loc) · 1.94 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
#include "cmake_project/impl/cprj_project_impl.hpp"
#include "exception/ih/exc_internal_error.hpp"
#include <std_fs>
#include <functional>
//------------------------------------------------------------------------------
namespace cmake_project {
//------------------------------------------------------------------------------
ProjectImpl::CountType ProjectImpl::getFilePathsCount() const
{
return m_files.size();
}
//------------------------------------------------------------------------------
void ProjectImpl::forEachFilePath( PathCallback _callback ) const
{
for( const Path & path : m_files )
{
if( !_callback( path ))
break;
}
}
//------------------------------------------------------------------------------
void ProjectImpl::forEachIncludes(
const Path & _file,
PathCallback _callback
) const
{
if( !m_includesByFiles.count( _file ) )
return;
const IncludesForFile & includes = m_includesByFiles.at( _file );
for( const Path * include : includes )
{
if( !include )
{
INTERNAL_CHECK_WARRING(false);
continue;
}
if( !_callback( *include ) )
break;
}
}
//------------------------------------------------------------------------------
void ProjectImpl::addFilePath( const Path & _path )
{
Path path = stdfs::lexically_normal( _path );
m_files.insert( path );
}
//------------------------------------------------------------------------------
void ProjectImpl::addIncludeToFile( const Path & _file, const Path & _include )
{
Path file = stdfs::lexically_normal( _file );
IncludesForFile & includes = m_includesByFiles[ file ];
const Path & include = addInclude( _include );
includes.push_back( &include );
}
//------------------------------------------------------------------------------
const ProjectImpl::Path & ProjectImpl::addInclude( const Path & _include )
{
auto pair = m_includes.insert( _include );
return *pair.first;
}
//------------------------------------------------------------------------------
}