File: Include.cc

package info (click to toggle)
fastdep 0.16-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 596 kB
  • ctags: 323
  • sloc: cpp: 2,144; ansic: 814; sh: 208; makefile: 124
file content (54 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (5)
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
#include "Include.h"
#include "FileCache.h"
#include "FileStructure.h"
#include "CompileState.h"
#include "os.h"

Include::Include(FileStructure* aStructure, const std::string& aFilename, bool aSystem)
	: Element(aStructure), Filename(aFilename), System(aSystem)
{
}

Include::Include(const Include& anOther)
	: Element(anOther), Filename(anOther.Filename), System(anOther.System)
{
}

Include::~Include()
{
}

Include& Include::operator=(const Include& anOther)
{
	if (this != &anOther)
	{
		Element::operator=(*this);
		Filename = anOther.Filename;
		System = anOther.System;
	}
	return *this;
}

Element* Include::copy() const
{
	return new Include(*this);
}

void Include::getDependencies(CompileState* aState)
{
	if (Filename.length() > 0)
	{
/*		std::string Fullname;
		if (Filename[0] == cPathSep)
			Fullname = Filename;
		else
			Fullname = getStructure()->getPath()+"/"+Filename; 
		aState->addDependencies(Fullname); */
		FileStructure* S = getCache()->update(getStructure()->getPath(),Filename,System);
		if (S /* && (std::string(S->getFileName(),0,4) != "/usr") */)
		{
			aState->addDependencies(S->getFileName());
			S->getDependencies(aState);
		}
	}
}