Skip to main content
summaryrefslogtreecommitdiffstats
blob: 09742d4909c325f78025cce2e65f12f5fce8d2d3 (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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
package org.eclipse.cdt.core.model;

/*
 * (c) Copyright QNX Software Systems Ltd. 2002.
 * All Rights Reserved.
 */
 
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;

/**
 * Common protocol for all elements provided by the C model.
 */
public interface ICElement extends IAdaptable {

	/**
	 * IResource from 10-20
	 */ 

	/**
	 * Constant representing a C Root workspace (IWorkspaceRoot object).
	 * A C element with this type can be safely cast to <code>ICModel</code>.
	 */
	static final int C_MODEL = 10;

	/**
	 * Constant representing a C project(IProject object).
	 * A C element with this type can be safely cast to <code>ICProject</code>.
	 */
	static final int C_PROJECT = 11;

	/**
	 * Constant representing a folder(ICContainer object).
	 * A C element with this type can be safely cast to <code>ICContainer</code>.
	 */
	static final int C_CCONTAINER = 12;

	static final int C_BINARY = 14;
	
	static final int C_ARCHIVE = 18;
	/**
	 * Virtual container serving as a place holder.
	 */
	static final int C_VCONTAINER = 30;

	/**
	 * Constant representing a C/C++ children of a Translation Unit
	 */
	static final int C_UNIT = 60;

	/**
	 * Namespace.
	 */
	static final int C_NAMESPACE = 61;

	/**
	 * Using.
	 */
	static final int C_USING = 62;

	/**
	 * Enumeration.
	 */
	static final int C_ENUMERATION = 63;

	/**
	 * Constant representing a class structure.
	 */
	static final int C_CLASS = 64;

	/**
	 * Constant representing a struct structure.
	 */
	static final int C_STRUCT = 65;

	/**
	 * Constant representing a union structure.
	 */
	static final int C_UNION = 66;

	/**
	 * A method definition part of a structure(class, struct, union).
	 */
	static final int C_METHOD = 67;

	/**
	 * A method declaration part of a structure(class, struct, union).
	 */
	static final int C_METHOD_DECLARATION = 68;

	/**
	 * A Field definition part of a structure(class, struct, union).
	 */
	static final int C_FIELD = 69;

	/**
	 * a C/C++ function prototype.
	 */
	static final int C_FUNCTION_DECLARATION = 70;

	/**
	 * a C/C++ function.
	 */
	static final int C_FUNCTION = 71;

	/**
	 * Preprocessor #include directive.
	 */
	static final int C_INCLUDE = 72;

	/**
	 * C++ template class.
	 */
	static final int C_TEMPLATE_CLASS = 73;

	/**
	 * Global variable.
	 */
	static final int C_VARIABLE = 74;

	/**
	 * variable Declaration.
	 */
	static final int C_VARIABLE_DECLARATION = 75;

	/**
	 * Local Variable.
	 */
	static final int C_VARIABLE_LOCAL = 76;

	/**
	 * A preprocessor macro.
	 */
	static final int C_MACRO = 77;

	/**
	 * a Typedef.
	 */
	static final int C_TYPEDEF = 78;
	
	/**
	 * Enumerator.
	 */
	static final int C_ENUMERATOR = 79;

	/**
	 * C++ template function.
	 */
	static final int C_TEMPLATE_FUNCTION = 80;

	/**
	 * C++ template method.
	 */
	static final int C_TEMPLATE_METHOD = 81;

	/**
	 * C++ template struct.
	 */
	static final int C_TEMPLATE_STRUCT = 82;

	/**
	 * C++ template union.
	 */
	static final int C_TEMPLATE_UNION = 83;

	/**
	 * C++ template variable.
	 */
	static final int C_TEMPLATE_VARIABLE = 84;

	/**
	 * Modifier indicating a class constructor
	 */
	static final int C_CLASS_CTOR = 0x100;
	
	/**
	 * Modifier indicating a class destructor
	 */
	static final int C_CLASS_DTOR = 0x200;
		
	/**
	 * Modifier indicating a static storage attribute
	 */
	static final int C_STORAGE_STATIC = 0x400;
		
	/**
	 * Modifier indicating an extern storage attribute
	 */
	static final int C_STORAGE_EXTERN = 0x800;

	/**
	 * Modifier indicating a private class
	 */
	static final int CPP_PRIVATE = 0x1000;

	/**
	 * Modifier indicating a public class
	 */

	static final int CPP_PUBLIC = 0x2000;

	/**
	 * Modifier indicating a friend class
	 */
	static final int CPP_FRIEND = 0x4000;

	/**
	 * Returns whether this C element exists in the model.
	 *
	 * @return <code>true</code> if this element exists in the C model
	 */
	boolean exists();

	/**
	 * Returns the name of this element.
	 *
	 * @return the element name
	 */
	String getElementName();

	/**
	 * Returns this element's kind encoded as an integer.
	 * This is a handle-only method.
	 *
	 * @return the kind of element; one of the constants declared in
	 *   <code>ICElement</code>
	 * @see ICElement
	 */
	int getElementType();

	/**
	 * Returns the C model.
	 *
	 * @return the C model
	 */
	ICModel getCModel();

	/**
	 * Returns the C project this element is contained in,
	 * or <code>null</code> if this element is not contained in any C project
	 *
	 * @return the containing C project, or <code>null</code> if this element is
	 *   not contained in a C project
	 */
	ICProject getCProject();

	/**
	 * Returns the element directly containing this element,
	 * or <code>null</code> if this element has no parent.
	 *
	 * @return the parent element, or <code>null</code> if this element has no parent
	 */
	ICElement getParent();

	/**
	 * Returns the path to the innermost resource enclosing this element. 
	 * If this element is not included in an external archive, 
	 * the path returned is the full, absolute path to the underlying resource, 
	 * relative to the workbench. 
	 * If this element is included in an external archive, 
	 * the path returned is the absolute path to the archive in the file system.
	 * This is a handle-only method.
	 * 
	 */
	IPath getPath();

	/**
	 * Returns the underlying resource that contains
	 * this element, or <code>null</code> if this element is not contained
	 * in a resource.
	 *
	 * @return the underlying resource, or <code>null</code> if none
	 * @exception CModelException if this element does not exist or if an
	 *		exception occurs while accessing its underlying resource
	 */
	IResource getUnderlyingResource() throws CModelException;

	/**
	 * Returns the Corresponding resource for
	 * this element, or <code>null</code> if this element does not have
	 * a corresponding resource.
	 *
	 * @return the corresponding resource, or <code>null</code> if none
	 * @exception CModelException if this element does not exist or if an
	 *		exception occurs while accessing its resource
	 */
	IResource getResource() ;
	/**
	 * Returns whether this C element is read-only. An element is read-only
	 * if its structure cannot be modified by the C model. 
	 *
	 * @return <code>true</code> if this element is read-only
	 */
	boolean isReadOnly();

	/**
	 * Returns whether the structure of this element is known. For example, for a
	 * translation unit that could not be parsed, <code>false</code> is returned.
	 * If the structure of an element is unknown, navigations will return reasonable
	 * defaults. For example, <code>getChildren</code> will return an empty collection.
	 * <p>
	 * Note: This does not imply anything about consistency with the
	 * underlying resource/buffer contents.
	 * </p>
	 *
	 * @return <code>true</code> if the structure of this element is known
	 * @exception CModelException if this element does not exist or if an
	 *		exception occurs while accessing its corresponding resource
	 */
	boolean isStructureKnown() throws CModelException;
}

Back to the top