Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f450891ceade851c889d46f600661d41db409f65 (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
/*******************************************************************************
 * Copyright (c) 2017 Nathan Ridge.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;

import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;

/**
 * Specialization of an alias template.
 */
public class CPPAliasTemplateSpecialization extends CPPSpecialization implements ICPPAliasTemplate {
	private ICPPTemplateParameter[] fParameters;
	private IType fAliasedType;
	
	public CPPAliasTemplateSpecialization(ICPPAliasTemplate specialized, IBinding owner, 
			ICPPTemplateParameterMap argumentMap, IType aliasedType) {
		super(specialized, owner, argumentMap);
		fAliasedType = aliasedType;
	}
	
	public void setTemplateParameters(ICPPTemplateParameter[] parameters) {
		fParameters = parameters;
	}
	
	@Override
	public boolean isSameType(IType type) {
		if (type == null) {
			return false;
		}
		return type.isSameType(fAliasedType);
	}

	@Override
	public ICPPTemplateParameter[] getTemplateParameters() {
		return fParameters;
	}

	@Override
	public IType getType() {
		return fAliasedType;
	}

    @Override
	public Object clone() {
        IType t = null;
   		try {
            t = (IType) super.clone();
        } catch (CloneNotSupportedException e) {
            // Not going to happen
        }
        return t;
    }
}

Back to the top