Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b7d34d8ee44f71ee51e34b2cd84280d69a7b9733 (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
/*******************************************************************************
 * Copyright (c) 2004, 2014 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:
 *     IBM - Initial API and implementation
 *     Markus Schorn (Wind River Systems)
 *     Sergey Prigogin (Google)
 *     Thomas Corbat (IFS)
 *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;

import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;

/**
 * C++ adds a few things to function declarators.
 *
 * @noimplement This interface is not intended to be implemented by clients.
 * @noextend This interface is not intended to be extended by clients.
 */
public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarator, ICPPASTDeclarator {
	/**
	 * @since 5.9
	 */
	public enum RefQualifier { LVALUE, RVALUE }
	
	/**
	 * Used as return value for {@link #getExceptionSpecification()}.
	 * @since 5.1
	 */
	public static final IASTTypeId[] NO_EXCEPTION_SPECIFICATION = {};
	
	/**
	 * Used as return value for {@link #getVirtSpecifiers()}.
	 * @since 5.7
	 */
	public static final ICPPASTVirtSpecifier[] NO_VIRT_SPECIFIERS = {};

	/**
	 * Represents a 'noexcept' specification without an expression.
	 * @since 5.5
	 */
	public static final ICPPASTLiteralExpression NOEXCEPT_DEFAULT =
			new CPPASTLiteralExpression(ICPPASTLiteralExpression.lk_true, Keywords.cTRUE);

	public static final ASTNodeProperty EXCEPTION_TYPEID = new ASTNodeProperty(
			"ICPPASTFunctionDeclarator.EXCEPTION_TYPEID [IASTTypeId]"); //$NON-NLS-1$
	/** @since 5.5 */
	public static final ASTNodeProperty NOEXCEPT_EXPRESSION = new ASTNodeProperty(
			"ICPPASTFunctionDeclarator.NOEXCEPT_EXPRESSION [ICPPASTExpression]"); //$NON-NLS-1$
	/** @since 5.2 */
	public static final ASTNodeProperty TRAILING_RETURN_TYPE = new ASTNodeProperty(
			"ICPPASTFunctionDeclarator.TRAILING_RETURN_TYPE [IASTTypeId]"); //$NON-NLS-1$
	/** @since 5.7 */
	public static final ASTNodeProperty VIRT_SPECIFIER = new ASTNodeProperty(
			"ICPPASTFunctionDeclarator.VIRT_SPECIFIER [ICPPASTVirtSpecifier]");  //$NON-NLS-1$
	
	/**
	 * Is this a const method?
	 */
	public boolean isConst();

	/**
	 * Sets the method to be const or not.
	 */
	public void setConst(boolean value);

	/**
	 * Is this a volatile method?
	 */
	public boolean isVolatile();

	/**
	 * Sets the method to be volatile or not.
	 */
	public void setVolatile(boolean value);

	/**
	 * When used as a lambda declarator, it can be mutable.
	 * @since 5.3
	 */
	public boolean isMutable();

	/**
	 * When used as a lambda declarator, it can be mutable.
	 * @since 5.3
	 */
	public void setMutable(boolean value);
	
	/**
	 * Is the method pure virtual?
	 */
	public boolean isPureVirtual();

	/**
	 * Sets this method to be pure virtual.
	 */
	public void setPureVirtual(boolean isPureVirtual);

	/**
	 * Returns the ref-qualifier.
	 * @since 5.9
	 */
	public RefQualifier getRefQualifier();

	/**
	 * Sets the ref-qualifier.
	 * @since 5.9
	 */
	public void setRefQualifier(RefQualifier value);

	/**
	 * @since 5.2
	 */
	@Override
	public ICPPASTParameterDeclaration[] getParameters();
	
	/**
	 * Returns an array of type-ids representing the exception specification. The return value
	 * {@link #NO_EXCEPTION_SPECIFICATION} indicates that no exceptions are specified, whereas
	 * {@link IASTTypeId#EMPTY_TYPEID_ARRAY} is used for an empty exception specification.
	 */
	public IASTTypeId[] getExceptionSpecification();

	/**
	 * Add an exception specification type Id.
	 */
	public void addExceptionSpecificationTypeId(IASTTypeId typeId);

	/**
	 * Configures the declarator with an empty exception specification (as opposed to having none). 
	 * 
	 * @since 5.1
	 */
	public void setEmptyExceptionSpecification();

	/**
	 * Returns the noexcept expression, {@link #NOEXCEPT_DEFAULT} if the noexcept specification
	 * does not contain an expression, or {@code null} the noexcept specification is not present.
	 * See C++11 5.4.1.
	 * @since 5.5
	 */
	public ICPPASTExpression getNoexceptExpression();

	/**
	 * Sets the noexcept expression. 
	 * @since 5.5
	 */
	public void setNoexceptExpression(ICPPASTExpression expression);

	/**
	 * Returns the trailing return type as in <code> auto f() -> int </code>, or <code>null</code>.
	 * @since 5.2
	 */
	public IASTTypeId getTrailingReturnType();

	/**
	 * Trailing return type as in <code> auto f() -> int </code>.
	 * @since 5.2
	 */
	public void setTrailingReturnType(IASTTypeId typeId);

	/**
	 * Get function scope this node represents. Returns <code>null</code>, if this declarator
	 * does not declare a function-prototype or function-definition.
	 */
	@Override
	public ICPPFunctionScope getFunctionScope();

	/**
	 * @since 5.1
	 */
	@Override
	public ICPPASTFunctionDeclarator copy();

	/**
	 * @since 5.3
	 */
	@Override
	public ICPPASTFunctionDeclarator copy(CopyStyle style);

	/**
	 * Returns whether this function is declared override.
	 * 
	 * @since 5.5
	 */
	public boolean isOverride();

	/**
	 * Returns whether this function is declared final.
	 * 
	 * @since 5.5
	 */
	public boolean isFinal();

	/**
	 * Returns the virt-specifiers of this function.
	 * @since 5.7
	 */
	public ICPPASTVirtSpecifier[] getVirtSpecifiers();
	
	/**
	 * Add a virt-specifiers to this function. 
	 * @since 5.7
	 */
	public void addVirtSpecifier(ICPPASTVirtSpecifier virtSpecifier);

	/**
	 * Set virt-specifiers of this function.
	 * @since 6.6
	 */
	public void setVirtSpecifiers(ICPPASTVirtSpecifier[] newVirtSpecifiers);

	/**
	 * @deprecated Not used.
	 * @noreference This field is not intended to be referenced by clients.
	 */
	@Deprecated
	public static final ASTNodeProperty CONSTRUCTOR_CHAIN_MEMBER = new ASTNodeProperty(
			"ICPPASTFunctionDeclarator.CONSTRUCTOR_CHAIN_MEMBER - Role of a Constructor Chain Initializer"); //$NON-NLS-1$
	
	/**
	 * @deprecated Use {@link ICPPASTFunctionDefinition#getMemberInitializers}, instead.
	 * @noreference This method is not intended to be referenced by clients.
	 */
	@Deprecated
	public ICPPASTConstructorChainInitializer[] getConstructorChain();

	/**
	 * @deprecated Use {@link ICPPASTFunctionDefinition#addMemberInitializer(ICPPASTConstructorChainInitializer)}.
	 * @noreference This method is not intended to be referenced by clients.
	 */
	@Deprecated
	public void addConstructorToChain(ICPPASTConstructorChainInitializer initializer);
	
	/**
	 * @since 5.5
	 * @deprecated Use {@link #addVirtSpecifier(ICPPASTVirtSpecifier)} instead.
	 * @noreference This method is not intended to be referenced by clients.
	 */
	@Deprecated
	public void setFinal(boolean isFinal);

	/**
	 * @since 5.5
	 * @deprecated Use {@link #addVirtSpecifier(ICPPASTVirtSpecifier)} instead.
	 * @noreference This method is not intended to be referenced by clients.
	 */
	@Deprecated
	public void setOverride(boolean isOverride);
}

Back to the top