Package org.eclipse.cdt.core.model
Interface ICElement
- All Superinterfaces:
org.eclipse.core.runtime.IAdaptable
- All Known Subinterfaces:
IArchive,IArchiveContainer,IAsmLabel,IBinary,IBinaryContainer,IBinaryElement,IBinaryFunction,IBinaryModule,IBinaryVariable,ICContainer,ICModel,IContributedCElement,ICProject,IDeclaration,IEnumeration,IEnumerator,IField,IFunction,IFunctionDeclaration,IFunctionTemplate,IFunctionTemplateDeclaration,IInclude,IIncludeReference,ILibraryReference,IMacro,IMember,IMethod,IMethodDeclaration,IMethodTemplate,IMethodTemplateDeclaration,INamespace,IPragma,ISourceRoot,IStructure,IStructureDeclaration,IStructureTemplate,IStructureTemplateDeclaration,ITranslationUnit,ITypeDef,IUsing,IVariable,IVariableDeclaration,IWorkingCopy
public interface ICElement
extends org.eclipse.core.runtime.IAdaptable
Common protocol for all elements provided by the C model.
- Restriction:
- This interface is not intended to be implemented by clients.
- Restriction:
- This interface is not intended to be extended by clients.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAssembly label.static final intstatic final intstatic final intConstant representing a folder (ICContainer object).static final intConstant representing a class structure.static final intDeprecated.static final intDeclaration of a class without the definition.static final intDeprecated.static final intEnumeration.static final intEnumerator.static final intA Field definition part of a structure(class, struct, union).static final inta C/C++ function definition.static final inta C/C++ function prototype.static final intPreprocessor #include directive.static final intA preprocessor macro.static final intA method definition part of a structure(class, struct, union).static final intA method declaration part of a structure(class, struct, union).static final intConstant representing a C Root workspace (IWorkspaceRoot object).static final intNamespace.static final intA pragma statement.static final intConstant representing a C project (IProject object).static final intDeprecated.not used anymorestatic final intDeprecated.static final intConstant representing a struct structure.static final intDeclaration of a structure without the definition.static final intC++ template class with definition.static final intC++ template class declaration without a definition.static final intC++ template function.static final intC++ template function declaration.static final intC++ template method.static final intC++ template method.static final intC++ template struct.static final intC++ template struct.static final intC++ template union.static final intC++ template union.static final intC++ template variable.static final inta Typedef.static final intConstant representing a union structure.static final intDeclaration of a union without the definition.static final intConstant representing a C/C++ children of a Translation Unitstatic final intAn unknown ICElement.static final intUsing.static final intGlobal variable.static final intvariable Declaration.static final intLocal Variable.static final intVirtual container serving as a place holder.static final intDeprecated.static final intDeprecated.static final intDeprecated.static final intDeprecated.static final ICElement[] -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ICElementVisitor visitor) Accept a visitor and walk the ICElement tree with it.booleanexists()Returns whether this C element exists in the model.getAncestor(int ancestorType) Returns the first ancestor of this C element that has the given type.Returns the C model.Returns the C project this element is contained in, ornullif this element is not contained in any C projectReturns the name of this element.intReturns this element's kind encoded as an integer.Returns a string representation of this element handle.Returns an absolute URI corresponding to the innermost file enclosing this element.Returns the element directly containing this element, ornullif this element has no parent.org.eclipse.core.runtime.IPathgetPath()Returns the path to the innermost resource enclosing this element.org.eclipse.core.resources.IResourceReturns the corresponding resource for this element, ornullif this element does not have a corresponding resource.org.eclipse.core.resources.IResourceReturns the underlying resource that contains this element, ornullif this element is not contained in a resource.booleanReturns whether this C element is read-only.booleanReturns whether the structure of this element is known.Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
-
Field Details
-
EMPTY_ARRAY
- Since:
- 5.6
-
C_MODEL
static final int C_MODELConstant representing a C Root workspace (IWorkspaceRoot object). A C element with this type can be safely cast toICModel.- See Also:
-
C_PROJECT
static final int C_PROJECTConstant representing a C project (IProject object). A C element with this type can be safely cast toICProject.- See Also:
-
C_CCONTAINER
static final int C_CCONTAINERConstant representing a folder (ICContainer object). A C element with this type can be safely cast toICContainer.- See Also:
-
C_BINARY
static final int C_BINARY- See Also:
-
C_ARCHIVE
static final int C_ARCHIVE- See Also:
-
C_VCONTAINER
static final int C_VCONTAINERVirtual container serving as a place holder.- See Also:
-
C_UNIT
static final int C_UNITConstant representing a C/C++ children of a Translation Unit- See Also:
-
C_NAMESPACE
static final int C_NAMESPACENamespace.- See Also:
-
C_USING
static final int C_USINGUsing.- See Also:
-
C_ENUMERATION
static final int C_ENUMERATIONEnumeration.- See Also:
-
C_CLASS_DECLARATION
static final int C_CLASS_DECLARATIONDeclaration of a class without the definition. class C;- See Also:
-
C_CLASS
static final int C_CLASSConstant representing a class structure.- See Also:
-
C_STRUCT_DECLARATION
static final int C_STRUCT_DECLARATIONDeclaration of a structure without the definition. struct C;- See Also:
-
C_STRUCT
static final int C_STRUCTConstant representing a struct structure.- See Also:
-
C_UNION_DECLARATION
static final int C_UNION_DECLARATIONDeclaration of a union without the definition. struct C;- See Also:
-
C_UNION
static final int C_UNIONConstant representing a union structure.- See Also:
-
C_METHOD
static final int C_METHODA method definition part of a structure(class, struct, union).- See Also:
-
C_METHOD_DECLARATION
static final int C_METHOD_DECLARATIONA method declaration part of a structure(class, struct, union).- See Also:
-
C_FIELD
static final int C_FIELDA Field definition part of a structure(class, struct, union).- See Also:
-
C_FUNCTION_DECLARATION
static final int C_FUNCTION_DECLARATIONa C/C++ function prototype.- See Also:
-
C_FUNCTION
static final int C_FUNCTIONa C/C++ function definition.- See Also:
-
C_INCLUDE
static final int C_INCLUDEPreprocessor #include directive.- See Also:
-
C_VARIABLE
static final int C_VARIABLEGlobal variable.- See Also:
-
C_VARIABLE_DECLARATION
static final int C_VARIABLE_DECLARATIONvariable Declaration.- See Also:
-
C_VARIABLE_LOCAL
static final int C_VARIABLE_LOCALLocal Variable.- See Also:
-
C_MACRO
static final int C_MACROA preprocessor macro.- See Also:
-
C_TYPEDEF
static final int C_TYPEDEFa Typedef.- See Also:
-
C_ENUMERATOR
static final int C_ENUMERATOREnumerator.- See Also:
-
C_TEMPLATE_CLASS_DECLARATION
static final int C_TEMPLATE_CLASS_DECLARATIONC++ template class declaration without a definition.- See Also:
-
C_TEMPLATE_CLASS
static final int C_TEMPLATE_CLASSC++ template class with definition.- See Also:
-
C_TEMPLATE_STRUCT_DECLARATION
static final int C_TEMPLATE_STRUCT_DECLARATIONC++ template struct.- See Also:
-
C_TEMPLATE_STRUCT
static final int C_TEMPLATE_STRUCTC++ template struct.- See Also:
-
C_TEMPLATE_UNION_DECLARATION
static final int C_TEMPLATE_UNION_DECLARATIONC++ template union.- See Also:
-
C_TEMPLATE_UNION
static final int C_TEMPLATE_UNIONC++ template union.- See Also:
-
C_TEMPLATE_FUNCTION_DECLARATION
static final int C_TEMPLATE_FUNCTION_DECLARATIONC++ template function declaration.- See Also:
-
C_TEMPLATE_FUNCTION
static final int C_TEMPLATE_FUNCTIONC++ template function.- See Also:
-
C_TEMPLATE_METHOD_DECLARATION
static final int C_TEMPLATE_METHOD_DECLARATIONC++ template method.- See Also:
-
C_TEMPLATE_METHOD
static final int C_TEMPLATE_METHODC++ template method.- See Also:
-
C_TEMPLATE_VARIABLE
static final int C_TEMPLATE_VARIABLEC++ template variable.- See Also:
-
C_UNKNOWN_DECLARATION
static final int C_UNKNOWN_DECLARATIONAn unknown ICElement. Mainly used to determine what elements are not yet implemented. i.e. the new DOM Parser supports open declaration on labels, while the old parser did not- See Also:
-
ASM_LABEL
static final int ASM_LABELAssembly label.- Since:
- 5.0
- See Also:
-
C_PRAGMA
static final int C_PRAGMAA pragma statement.- Since:
- 7.3
- See Also:
-
C_CLASS_CTOR
Deprecated.- See Also:
- Restriction:
- This field is not intended to be referenced by clients.
-
C_CLASS_DTOR
Deprecated.- See Also:
- Restriction:
- This field is not intended to be referenced by clients.
-
C_STORAGE_STATIC
Deprecated.- See Also:
- Restriction:
- This field is not intended to be referenced by clients.
-
C_STORAGE_EXTERN
Deprecated.not used anymore- See Also:
- Restriction:
- This field is not intended to be referenced by clients.
-
CPP_PRIVATE
Deprecated.- See Also:
- Restriction:
- This field is not intended to be referenced by clients.
-
CPP_PUBLIC
Deprecated.- See Also:
- Restriction:
- This field is not intended to be referenced by clients.
-
CPP_PROTECTED
Deprecated.- See Also:
- Restriction:
- This field is not intended to be referenced by clients.
-
CPP_FRIEND
Deprecated.- See Also:
- Restriction:
- This field is not intended to be referenced by clients.
-
-
Method Details
-
exists
boolean exists()Returns whether this C element exists in the model.- Returns:
trueif this element exists in the C model
-
getAncestor
Returns the first ancestor of this C element that has the given type. Returnsnullif no such an ancestor can be found. This is a handle-only method.- Parameters:
ancestorType- the given type- Returns:
- the first ancestor of this C element that has the given type,
nullif no such an ancestor can be found - Since:
- 2.0
-
getElementName
String getElementName()Returns the name of this element.- Returns:
- the element name
-
getElementType
int getElementType()Returns this element's kind encoded as an integer. This is a handle-only method.- Returns:
- the kind of element; one of the constants declared in
ICElement
-
getCModel
ICModel getCModel()Returns the C model.- Returns:
- the C model
-
getCProject
ICProject getCProject()Returns the C project this element is contained in, ornullif this element is not contained in any C project- Returns:
- the containing C project, or
nullif this element is not contained in a C project
-
getParent
ICElement getParent()Returns the element directly containing this element, ornullif this element has no parent.- Returns:
- the parent element, or
nullif this element has no parent
-
getPath
org.eclipse.core.runtime.IPath getPath()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. -
getLocationURI
URI getLocationURI()Returns an absolute URI corresponding to the innermost file enclosing this element.- Returns:
- the URI corresponding to the location
- Since:
- 5.0
-
getUnderlyingResource
org.eclipse.core.resources.IResource getUnderlyingResource()Returns the underlying resource that contains this element, ornullif this element is not contained in a resource.- Returns:
- the underlying resource, or
nullif none
-
getResource
org.eclipse.core.resources.IResource getResource()Returns the corresponding resource for this element, ornullif this element does not have a corresponding resource.- Returns:
- the corresponding resource, or
nullif none
-
isReadOnly
boolean isReadOnly()Returns whether this C element is read-only. An element is read-only if its structure cannot be modified by the C model.- Returns:
trueif this element is read-only
-
isStructureKnown
Returns whether the structure of this element is known. For example, for a translation unit that could not be parsed,falseis returned. If the structure of an element is unknown, navigations will return reasonable defaults. For example,getChildrenwill return an empty collection.Note: This does not imply anything about consistency with the underlying resource/buffer contents.
- Returns:
trueif the structure of this element is known- Throws:
CModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource
-
accept
Accept a visitor and walk the ICElement tree with it.- Parameters:
visitor-- Throws:
CModelExceptionorg.eclipse.core.runtime.CoreException
-
getHandleIdentifier
String getHandleIdentifier()Returns a string representation of this element handle. The format of the string is not specified; however, the identifier is stable across workspace sessions, and can be used to recreate this handle via theCoreModel.create(String)method.Some element types, like binaries, do not support handle identifiers and return
null.- Returns:
- the string handle identifier, or
nullif the element type is not supported - Since:
- 5.0
- See Also:
-
IMethodDeclaration.isConstructor()