-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspiderdefault.cpp
39 lines (33 loc) · 946 Bytes
/
spiderdefault.cpp
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
//@ {
//@ "targets":[{"name":"spiderdefault.o","type":"object"}]
//@ }
#include "spiderdefault.hpp"
#include "directorylister.hpp"
#include "target_factorydelegator.hpp"
#include "stringkey.hpp"
using namespace Maike;
SpiderDefault::SpiderDefault(Target_FactoryDelegator& target_creator,DependencyGraph& targets):
r_target_creator(target_creator),r_targets(targets)
{
}
SpiderDefault& SpiderDefault::scanFile(const char* filename,const char* in_dir)
{
if(m_files_visited.find(VisitedKey(filename))==m_files_visited.end())
{
m_files_to_scan.push({filename,in_dir});
m_files_visited.insert(VisitedKey(filename));
}
return *this;
}
SpiderDefault& SpiderDefault::run()
{
while(!m_files_to_scan.empty())
{
auto p=std::move(m_files_to_scan.top());
m_files_to_scan.pop();
auto filename=p.first.c_str();
auto in_dir=p.second.c_str();
r_target_creator.targetsLoad(filename,in_dir,*this,r_targets);
}
return *this;
}