Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 39b9c656251744543c1ef0217d3dd593f01c3c8f (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
/*******************************************************************************
 * Copyright (c) 2004, 2009 IBM Corporation 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:
 *    Doug Schaefer (IBM) - Initial API and implementation
 *    Markus Schorn (Wind River Systems)
 *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;

/**
 * Base interface for all template parameters (non-type, type and template).
 * 
 * @noextend This interface is not intended to be extended by clients.
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface ICPPTemplateParameter extends ICPPBinding {
	public static final ICPPTemplateParameter[] EMPTY_TEMPLATE_PARAMETER_ARRAY = new ICPPTemplateParameter[0];

	/**
	 * Returns the zero-based position of this parameter within the template parameter list it belongs to. 
	 * @since 5.1
	 */
	short getParameterPosition();

	/**
	 * Returns the nesting-level of the template declaration this parameter belongs to.
	 * <p>
	 * The nesting level is determined by counting enclosing template declarations,
	 * for example:
	 * <pre>
	 * namespace ns {
	 *    template<typename T> class X {       // nesting level 0
	 *       template<typename U> class Y1 {   // nesting level 1
	 *       };
	 *       class Y2 {
	 *          template typename<V> class Z { // nesting level 1
	 *             void m();
	 *          };  
	 *       };
	 *    };
	 * }
	 * template<typename T>                    // nesting level 0
	 *    template <typename V>                // nesting level 1
	 *       void ns::X<T>::Y2::Z<V>::m() {}
	 * </pre>
	 * @since 5.1
	 */
	short getTemplateNestingLevel();
	
	/**
	 * Returns {@code (getTemplateNestingLevel() << 16) + getParameterPosition()}.
	 * @since 5.1
	 */
	int getParameterID();
	
	/**
	 * Returns the default value for this template parameter, or <code>null</code>.
	 * @since 5.1
	 */
	ICPPTemplateArgument getDefaultValue();
}

Back to the top