Eclipse CDT
Pre-release 3.0

org.eclipse.cdt.core.model
Interface ICElement

All Known Subinterfaces:
IArchive, IArchiveContainer, IBinary, IBinaryContainer, IBinaryElement, IBinaryFunction, IBinaryModule, IBinaryVariable, ICContainer, ICModel, ICProject, IDeclaration, IEnumeration, IEnumerator, IField, IFunction, IFunctionDeclaration, IFunctionTemplate, IFunctionTemplateDeclaration, IInclude, IIncludeReference, ILibraryReference, IMacro, IMember, IMethod, IMethodDeclaration, IMethodTemplate, IMethodTemplateDeclaration, INamespace, ISourceRoot, IStructure, IStructureDeclaration, IStructureTemplate, IStructureTemplateDeclaration, ITranslationUnit, ITypeDef, IUsing, IVariable, IVariableDeclaration, IWorkingCopy

public interface ICElement

Common protocol for all elements provided by the C model.


Field Summary
static int C_ARCHIVE
           
static int C_BINARY
           
static int C_CCONTAINER
          Constant representing a folder(ICContainer object).
static int C_CLASS
          Constant representing a class structure.
static int C_CLASS_CTOR
          Modifier indicating a class constructor
static int C_CLASS_DECLARATION
          Declaration of a class without the definition.
static int C_CLASS_DTOR
          Modifier indicating a class destructor
static int C_ENUMERATION
          Enumeration.
static int C_ENUMERATOR
          Enumerator.
static int C_FIELD
          A Field definition part of a structure(class, struct, union).
static int C_FUNCTION
          a C/C++ function definition.
static int C_FUNCTION_DECLARATION
          a C/C++ function prototype.
static int C_INCLUDE
          Preprocessor #include directive.
static int C_MACRO
          A preprocessor macro.
static int C_METHOD
          A method definition part of a structure(class, struct, union).
static int C_METHOD_DECLARATION
          A method declaration part of a structure(class, struct, union).
static int C_MODEL
          Constant representing a C Root workspace (IWorkspaceRoot object).
static int C_NAMESPACE
          Namespace.
static int C_PROJECT
          Constant representing a C project(IProject object).
static int C_STORAGE_EXTERN
          Modifier indicating an extern storage attribute
static int C_STORAGE_STATIC
          Modifier indicating a static storage attribute
static int C_STRUCT
          Constant representing a struct structure.
static int C_STRUCT_DECLARATION
          Declaration of a structure without the definition.
static int C_TEMPLATE_CLASS
          C++ template class with definition.
static int C_TEMPLATE_CLASS_DECLARATION
          C++ template class declaration without a definiton.
static int C_TEMPLATE_FUNCTION
          C++ template function.
static int C_TEMPLATE_FUNCTION_DECLARATION
          C++ template function declaration.
static int C_TEMPLATE_METHOD
          C++ template method.
static int C_TEMPLATE_METHOD_DECLARATION
          C++ template method.
static int C_TEMPLATE_STRUCT
          C++ template struct.
static int C_TEMPLATE_STRUCT_DECLARATION
          C++ template struct.
static int C_TEMPLATE_UNION
          C++ template union.
static int C_TEMPLATE_UNION_DECLARATION
          C++ template union.
static int C_TEMPLATE_VARIABLE
          C++ template variable.
static int C_TYPEDEF
          a Typedef.
static int C_UNION
          Constant representing a union structure.
static int C_UNION_DECLARATION
          Declaration of a union without the definition.
static int C_UNIT
          Constant representing a C/C++ children of a Translation Unit
static int C_UNKNOWN_DECLARATION
          An unknown ICElement.
static int C_USING
          Using.
static int C_VARIABLE
          Global variable.
static int C_VARIABLE_DECLARATION
          variable Declaration.
static int C_VARIABLE_LOCAL
          Local Variable.
static int C_VCONTAINER
          Virtual container serving as a place holder.
static int CPP_FRIEND
          Modifier indicating a friend class
static int CPP_PRIVATE
          Modifier indicating a private class
static int CPP_PROTECTED
          Modifier indicating a protected class
static int CPP_PUBLIC
          Modifier indicating a public class
 
Method Summary
 void accept(ICElementVisitor visitor)
          Accept a visitor and walk the ICElement tree with it.
 boolean exists()
          Returns whether this C element exists in the model.
 ICElement getAncestor(int ancestorType)
          Returns the first ancestor of this C element that has the given type.
 ICModel getCModel()
          Returns the C model.
 ICProject getCProject()
          Returns the C project this element is contained in, or null if this element is not contained in any C project
 String getElementName()
          Returns the name of this element.
 int getElementType()
          Returns this element's kind encoded as an integer.
 ICElement getParent()
          Returns the element directly containing this element, or null if this element has no parent.
 IPath getPath()
          Returns the path to the innermost resource enclosing this element.
 IResource getResource()
          Returns the Corresponding resource for this element, or null if this element does not have a corresponding resource.
 IResource getUnderlyingResource()
          Returns the underlying resource that contains this element, or null if this element is not contained in a resource.
 boolean isReadOnly()
          Returns whether this C element is read-only.
 boolean isStructureKnown()
          Returns whether the structure of this element is known.
 

Field Detail

C_MODEL

static final int C_MODEL
Constant representing a C Root workspace (IWorkspaceRoot object). A C element with this type can be safely cast to ICModel.

See Also:
Constant Field Values

C_PROJECT

static final int C_PROJECT
Constant representing a C project(IProject object). A C element with this type can be safely cast to ICProject.

See Also:
Constant Field Values

C_CCONTAINER

static final int C_CCONTAINER
Constant representing a folder(ICContainer object). A C element with this type can be safely cast to ICContainer.

See Also:
Constant Field Values

C_BINARY

static final int C_BINARY
See Also:
Constant Field Values

C_ARCHIVE

static final int C_ARCHIVE
See Also:
Constant Field Values

C_VCONTAINER

static final int C_VCONTAINER
Virtual container serving as a place holder.

See Also:
Constant Field Values

C_UNIT

static final int C_UNIT
Constant representing a C/C++ children of a Translation Unit

See Also:
Constant Field Values

C_NAMESPACE

static final int C_NAMESPACE
Namespace.

See Also:
Constant Field Values

C_USING

static final int C_USING
Using.

See Also:
Constant Field Values

C_ENUMERATION

static final int C_ENUMERATION
Enumeration.

See Also:
Constant Field Values

C_CLASS_DECLARATION

static final int C_CLASS_DECLARATION
Declaration of a class without the definition. class C;

See Also:
Constant Field Values

C_CLASS

static final int C_CLASS
Constant representing a class structure.

See Also:
Constant Field Values

C_STRUCT_DECLARATION

static final int C_STRUCT_DECLARATION
Declaration of a structure without the definition. struct C;

See Also:
Constant Field Values

C_STRUCT

static final int C_STRUCT
Constant representing a struct structure.

See Also:
Constant Field Values

C_UNION_DECLARATION

static final int C_UNION_DECLARATION
Declaration of a union without the definition. struct C;

See Also:
Constant Field Values

C_UNION

static final int C_UNION
Constant representing a union structure.

See Also:
Constant Field Values

C_METHOD

static final int C_METHOD
A method definition part of a structure(class, struct, union).

See Also:
Constant Field Values

C_METHOD_DECLARATION

static final int C_METHOD_DECLARATION
A method declaration part of a structure(class, struct, union).

See Also:
Constant Field Values

C_FIELD

static final int C_FIELD
A Field definition part of a structure(class, struct, union).

See Also:
Constant Field Values

C_FUNCTION_DECLARATION

static final int C_FUNCTION_DECLARATION
a C/C++ function prototype.

See Also:
Constant Field Values

C_FUNCTION

static final int C_FUNCTION
a C/C++ function definition.

See Also:
Constant Field Values

C_INCLUDE

static final int C_INCLUDE
Preprocessor #include directive.

See Also:
Constant Field Values

C_VARIABLE

static final int C_VARIABLE
Global variable.

See Also:
Constant Field Values

C_VARIABLE_DECLARATION

static final int C_VARIABLE_DECLARATION
variable Declaration.

See Also:
Constant Field Values

C_VARIABLE_LOCAL

static final int C_VARIABLE_LOCAL
Local Variable.

See Also:
Constant Field Values

C_MACRO

static final int C_MACRO
A preprocessor macro.

See Also:
Constant Field Values

C_TYPEDEF

static final int C_TYPEDEF
a Typedef.

See Also:
Constant Field Values

C_ENUMERATOR

static final int C_ENUMERATOR
Enumerator.

See Also:
Constant Field Values

C_TEMPLATE_CLASS_DECLARATION

static final int C_TEMPLATE_CLASS_DECLARATION
C++ template class declaration without a definiton.

See Also:
Constant Field Values

C_TEMPLATE_CLASS

static final int C_TEMPLATE_CLASS
C++ template class with definition.

See Also:
Constant Field Values

C_TEMPLATE_STRUCT_DECLARATION

static final int C_TEMPLATE_STRUCT_DECLARATION
C++ template struct.

See Also:
Constant Field Values

C_TEMPLATE_STRUCT

static final int C_TEMPLATE_STRUCT
C++ template struct.

See Also:
Constant Field Values

C_TEMPLATE_UNION_DECLARATION

static final int C_TEMPLATE_UNION_DECLARATION
C++ template union.

See Also:
Constant Field Values

C_TEMPLATE_UNION

static final int C_TEMPLATE_UNION
C++ template union.

See Also:
Constant Field Values

C_TEMPLATE_FUNCTION_DECLARATION

static final int C_TEMPLATE_FUNCTION_DECLARATION
C++ template function declaration.

See Also:
Constant Field Values

C_TEMPLATE_FUNCTION

static final int C_TEMPLATE_FUNCTION
C++ template function.

See Also:
Constant Field Values

C_TEMPLATE_METHOD_DECLARATION

static final int C_TEMPLATE_METHOD_DECLARATION
C++ template method.

See Also:
Constant Field Values

C_TEMPLATE_METHOD

static final int C_TEMPLATE_METHOD
C++ template method.

See Also:
Constant Field Values

C_TEMPLATE_VARIABLE

static final int C_TEMPLATE_VARIABLE
C++ template variable.

See Also:
Constant Field Values

C_UNKNOWN_DECLARATION

static final int C_UNKNOWN_DECLARATION
An 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:
Constant Field Values

C_CLASS_CTOR

static final int C_CLASS_CTOR
Modifier indicating a class constructor

See Also:
Constant Field Values

C_CLASS_DTOR

static final int C_CLASS_DTOR
Modifier indicating a class destructor

See Also:
Constant Field Values

C_STORAGE_STATIC

static final int C_STORAGE_STATIC
Modifier indicating a static storage attribute

See Also:
Constant Field Values

C_STORAGE_EXTERN

static final int C_STORAGE_EXTERN
Modifier indicating an extern storage attribute

See Also:
Constant Field Values

CPP_PRIVATE

static final int CPP_PRIVATE
Modifier indicating a private class

See Also:
Constant Field Values

CPP_PUBLIC

static final int CPP_PUBLIC
Modifier indicating a public class

See Also:
Constant Field Values

CPP_PROTECTED

static final int CPP_PROTECTED
Modifier indicating a protected class

See Also:
Constant Field Values

CPP_FRIEND

static final int CPP_FRIEND
Modifier indicating a friend class

See Also:
Constant Field Values
Method Detail

exists

boolean exists()
Returns whether this C element exists in the model.

Returns:
true if this element exists in the C model

getAncestor

ICElement getAncestor(int ancestorType)
Returns the first ancestor of this C element that has the given type. Returns null if 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, null if 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
See Also:
ICElement

getCModel

ICModel getCModel()
Returns the C model.

Returns:
the C model

getCProject

ICProject getCProject()
Returns the C project this element is contained in, or null if this element is not contained in any C project

Returns:
the containing C project, or null if this element is not contained in a C project

getParent

ICElement getParent()
Returns the element directly containing this element, or null if this element has no parent.

Returns:
the parent element, or null if this element has no parent

getPath

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.


getUnderlyingResource

IResource getUnderlyingResource()
Returns the underlying resource that contains this element, or null if this element is not contained in a resource.

Returns:
the underlying resource, or null if none
Throws:
CModelException - if this element does not exist or if an exception occurs while accessing its underlying resource

getResource

IResource getResource()
Returns the Corresponding resource for this element, or null if this element does not have a corresponding resource.

Returns:
the corresponding resource, or null if none
Throws:
CModelException - if this element does not exist or if an exception occurs while accessing its resource

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:
true if this element is read-only

isStructureKnown

boolean isStructureKnown()
                         throws CModelException
Returns whether the structure of this element is known. For example, for a translation unit that could not be parsed, false is returned. If the structure of an element is unknown, navigations will return reasonable defaults. For example, getChildren will return an empty collection.

Note: This does not imply anything about consistency with the underlying resource/buffer contents.

Returns:
true if 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

void accept(ICElementVisitor visitor)
            throws CoreException
Accept a visitor and walk the ICElement tree with it.

Parameters:
visitor -
Throws:
CModelException
CoreException

Eclipse CDT
Pre-release 3.0

Copyright (c) IBM Corp. and others 2004. All Rights Reserved.