forked from duyanning/cpps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdateDependencyGraphAction.cpp
More file actions
40 lines (32 loc) · 996 Bytes
/
Copy pathUpdateDependencyGraphAction.cpp
File metadata and controls
40 lines (32 loc) · 996 Bytes
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
#include "std.h"
#include "UpdateDependencyGraphAction.h"
UpdateDependencyGraphAction::UpdateDependencyGraphAction(FileEntityPtr obj)
:
m_obj(obj)
{
}
UpdateDependencyGraphActionPtr makeUpdateDependencyGraphAction(FileEntityPtr obj)
{
return UpdateDependencyGraphActionPtr(new UpdateDependencyGraphAction(obj));
}
void UpdateDependencyGraphAction::execute(EntityPtr target, vector<EntityPtr>& allPre, vector<EntityPtr>& changedPre)
{
FileEntityPtr dep = static_pointer_cast<FileEntity>(allPre[0]);
fs::path dep_path = dep->path();
ifstream f(dep_path.native());
istream_iterator<string> i = istream_iterator<string>(f);
// skip the first and second
int count = 0;
while (count < 2) {
if (*i != "\\")
count++;
++i;
}
for (; i != istream_iterator<string>(); ++i) {
string t = *i;
if (t != "\\") {
fs::path p(t);
m_obj->addPrerequisite(makeFileEntity(p));
}
}
}