File: If.h

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 (81 lines) | stat: -rw-r--r-- 1,543 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
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
#ifndef IF_H_
#define IF_H_

#include "Element.h"

#include <string>
#include <vector>

class CompileState;
class FileStructure;
class Sequence;

class If : public Element
{
	public:
		class Control
		{
			public:
				virtual ~Control() = 0;
				virtual Control* copy() const = 0;
				virtual bool isTrue(CompileState* aState) const = 0;
		};

		class IfDef : public Control
		{
			public:
				IfDef(const std::string& aName);
				IfDef(const IfDef& anOther);
				virtual ~IfDef();
				virtual Control* copy() const;
				virtual bool isTrue(CompileState* aState) const;
			private:
				std::string Macro;
		};

		class IfNDef : public Control
		{
			public:
				IfNDef(const std::string& aName);
				IfNDef(const IfNDef& anOther);
				virtual ~IfNDef();
				virtual Control* copy() const;
				virtual bool isTrue(CompileState* aState) const;
			private:
				std::string Macro;
		};

		class IfTest : public Control
		{
			public:
				IfTest(const std::string& anControl);
				IfTest(const IfTest& anOther);

				virtual Control* copy() const;
				virtual bool isTrue(CompileState* aState) const;
			private:
				std::string theExpression;
		};

	public:
		If(FileStructure* aStructure);
		If(const If& anOther);
		virtual ~If();

		If& operator=(const If& anOther);

		virtual Element* copy() const;
		virtual void getDependencies(CompileState* aState);

		Sequence* addIf(Control* anExpr);
		Sequence* addElse();
		Sequence* getLastScope();

	private:
		std::vector<Control*> Expr;
		std::vector<Sequence*> Seq;
		Sequence* Else;
};

#endif