Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f211c34b475dfae5e1bdfc887dde2e27b64f4576 (plain) (blame)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*******************************************************************************
 * Copyright (c) 2000, 2010 QNX Software Systems and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     QNX Software Systems - Initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.make.internal.core.makefile;

import org.eclipse.cdt.make.core.makefile.IMacroDefinition;

/**
 */
public class MacroDefinition extends Directive implements IMacroDefinition {
	String name;
	StringBuffer value;
	boolean fromCommand;
	boolean fromDefault;
	boolean fromMakefile;
	boolean fromEnvironment;
	boolean fromEnvironmentOverride;

	public MacroDefinition(Directive parent, String n, StringBuffer v) {
		super(parent);
		name = n;
		value = v;
	}

	public String getName() {
		return name;
	}

	public void setName(String n) {
		name = (n == null) ? "" : n.trim() ; //$NON-NLS-1$
	}

	public StringBuffer getValue() {
		return value;
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuffer buffer = new StringBuffer();
		buffer.append(getName()).append(" = ").append(getValue()).append('\n'); //$NON-NLS-1$
		return buffer.toString();
	}

	public boolean equals(MacroDefinition v) {
		return v.getName().equals(getName());
	}

	public void setFromCommand(boolean from) {
		fromCommand = from;
	}

	public void setFromDefault(boolean from) {
		fromDefault = from;
	}

	public void setFromEnviroment(boolean from) {
		fromEnvironment = from;
	}

	public void setFromEnviromentOverride(boolean from) {
		fromEnvironmentOverride = from;
	}

	public void setFromMakefile(boolean from) {
		fromMakefile = from;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromCommand()
	 */
	public boolean isFromCommand() {
		return fromCommand;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromDefault()
	 */
	public boolean isFromDefault() {
		return fromDefault;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromEnviroment()
	 */
	public boolean isFromEnviroment() {
		return fromEnvironment;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromEnviroment()
	 */
	public boolean isFromEnvironmentOverride() {
		return fromEnvironmentOverride;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromMakefile()
	 */
	public boolean isFromMakefile() {
		return fromMakefile;
	}

}

Back to the top