Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: deacec1c98d1cb26729198b43ea94edebfa90c70 (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
/*******************************************************************************
 * Copyright (c) 2015, 2016 Institute for Software, HSR Hochschule fuer Technik
 * Rapperswil, University of applied sciences.
 * 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:
 *     Lukas Wegmann (IFS) - Initial API and implementation
 *     Sergey Prigogin (Google)
 *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;

import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFieldTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;

/**
 * An instance of a field template.
 */
public class CPPFieldInstance extends CPPVariableInstance implements ICPPField {

	public CPPFieldInstance(IBinding specialized, IBinding owner, ICPPTemplateParameterMap argumentMap,
			ICPPTemplateArgument[] args, IType tpe, IValue value) {
		super(specialized, owner, argumentMap, args, tpe, value);
	}

	@Override
	public ICompositeType getCompositeTypeOwner() {
		return getClassOwner();
	}

	@Override
	public int getVisibility() {
		return ((ICPPFieldTemplate) getSpecializedBinding()).getVisibility();
	}

	@Override
	public ICPPClassType getClassOwner() {
		try {
			ICPPClassScope scope = (ICPPClassScope) getScope();
			return scope.getClassType();
		} catch (DOMException e) {
			return null;
		}
	}

	@Override
	public int getFieldPosition() {
		return ((ICPPFieldTemplate) getSpecializedBinding()).getFieldPosition();
	}
}

Back to the top