File: Sequence.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 (49 lines) | stat: -rw-r--r-- 937 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
#include "Sequence.h"

Sequence::Sequence(FileStructure* aStructure)
	: Element(aStructure)
{
}

Sequence::Sequence(const Sequence& anOther)
	: Element(anOther)
{
	for (unsigned int i=0; i<anOther.Seq.size(); ++i)
		Seq.push_back(anOther.Seq[i]->copy());
}

Sequence::~Sequence()
{
	for (unsigned int i=0; i<Seq.size(); ++i)
		delete Seq[i];
}

Sequence& Sequence::operator=(const Sequence& anOther)
{
	if (this != &anOther)
	{
		Element::operator=(*this);
		for (unsigned int i=0; i<Seq.size(); ++i)
			delete Seq[i];
		Seq.erase(Seq.begin(), Seq.end());
		for (unsigned int j=0; j<anOther.Seq.size(); ++j)
			Seq.push_back(anOther.Seq[j]->copy());
	}
	return *this;
}

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

void Sequence::add(Element* anElem)
{
	Seq.push_back(anElem);
}

void Sequence::getDependencies(CompileState* aState)
{
	for (unsigned int i=0; i<Seq.size(); ++i)
		Seq[i]->getDependencies(aState);
}