Package org.eclipse.cdt.core.dom.ast

# Interface IASTDeclarator

All Superinterfaces:
  `IASTAttributeOwner`, `IASTNameOwner`, `IASTNode`

All Known Subinterfaces:
  `IASTArrayDeclarator`, `IASTFieldDeclarator`, `IASTFunctionDeclarator`, `IASTStandardFunctionDeclarator`, `ICASTKnRFunctionDeclarator`, `ICPPASTArrayDeclarator`, `ICPPASTDeclarator`, `ICPPASTFieldDeclarator`, `ICPPASTFunctionDeclarator`, `ICPPASTFunctionTryBlockDeclarator`

public interface IASTDeclarator extends IASTNameOwner, IASTAttributeOwner
Base interface for a declarator.

Restriction:
  This interface is not intended to be implemented by clients.
Restriction:
  This interface is not intended to be extended by clients.

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.eclipse.cdt.core.dom.ast.IASTNode

`IASTNode.CopyStyle`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final ASTNodeProperty`
`DECLARATOR_NAME`
`DECLARATOR_NAME` represents the relationship between an `IASTDeclarator` and an `IASTName`.
`static final IASTDeclarator[]`
`EMPTY_DECLARATOR_ARRAY`
Constant - empty declarator array
`static final ASTNodeProperty`
`INITIALIZER`
`INITIALIZER` represents the relationship between an `IASTDeclarator` and an `IASTInitializer`.
`static final ASTNodeProperty`
`NESTED_DECLARATOR`
`NESTED_DECLARATOR` represents the relationship between an `IASTDeclarator` and a nested `IASTDeclarator`.
`static final ASTNodeProperty`
`POINTER_OPERATOR`
`POINTER_OPERATOR` represents the relationship between an `IASTDeclarator` and an `IASTPointerOperator`.

### Fields inherited from interface org.eclipse.cdt.core.dom.ast.IASTAttributeOwner

`ATTRIBUTE, ATTRIBUTE_SPECIFIER`

### Fields inherited from interface org.eclipse.cdt.core.dom.ast.IASTNameOwner

`r_declaration, r_definition, r_reference, r_unclear`

### Fields inherited from interface org.eclipse.cdt.core.dom.ast.IASTNode

`EMPTY_NODE_ARRAY`

## Method Summary

Modifier and Type
Method
Description
`void`
`addPointerOperator(IASTPointerOperator operator)`
Adds a pointer operator to the declarator.
`IASTDeclarator`
`copy()`
Returns a mutable copy of the tree rooted at this node.
`IASTDeclarator`
`copy(IASTNode.CopyStyle style)`
Returns a mutable copy of the tree rooted at this node.
`IASTInitializer`
`getInitializer()`
Returns the optional initializer for this declarator.
`IASTName`
`getName()`
Returns the name of the declarator.
`IASTDeclarator`
`getNestedDeclarator()`
If the declarator is nested in parentheses, returns the declarator as found in those parentheses.
`IASTPointerOperator[]`
`getPointerOperators()`
This is the list of pointer operators applied to the type for the declarator.
`void`
`setInitializer(IASTInitializer initializer)`
Set the optional initializer.
`void`
`setName(IASTName name)`
Sets the name of he declarator.
`void`
`setNestedDeclarator(IASTDeclarator nested)`

### Methods inherited from interface org.eclipse.cdt.core.dom.ast.IASTAttributeOwner

`addAttribute, addAttributeSpecifier, getAttributes, getAttributeSpecifiers`

### Methods inherited from interface org.eclipse.cdt.core.dom.ast.IASTNameOwner

`getRoleForName`

### Methods inherited from interface org.eclipse.cdt.core.dom.ast.IASTNode

`accept, contains, getChildren, getContainingFilename, getFileLocation, getLeadingSyntax, getNodeLocations, getOriginalNode, getParent, getPropertyInParent, getRawSignature, getSyntax, getTrailingSyntax, getTranslationUnit, isActive, isFrozen, isPartOfTranslationUnitFile, setParent, setPropertyInParent`

## Field Details

### EMPTY_DECLARATOR_ARRAY

static final IASTDeclarator[] EMPTY_DECLARATOR_ARRAY
Constant - empty declarator array

### POINTER_OPERATOR

static final ASTNodeProperty POINTER_OPERATOR
`POINTER_OPERATOR` represents the relationship between an `IASTDeclarator` and an `IASTPointerOperator`.

### INITIALIZER

static final ASTNodeProperty INITIALIZER
`INITIALIZER` represents the relationship between an `IASTDeclarator` and an `IASTInitializer`.

### NESTED_DECLARATOR

static final ASTNodeProperty NESTED_DECLARATOR
`NESTED_DECLARATOR` represents the relationship between an `IASTDeclarator` and a nested `IASTDeclarator`.

### DECLARATOR_NAME

static final ASTNodeProperty DECLARATOR_NAME
`DECLARATOR_NAME` represents the relationship between an `IASTDeclarator` and an `IASTName`.

## Method Details

### getPointerOperators

IASTPointerOperator[] getPointerOperators()
This is the list of pointer operators applied to the type for the declarator.

Returns:
  array of IASTPointerOperator

### addPointerOperator

void addPointerOperator(IASTPointerOperator operator)
Adds a pointer operator to the declarator.

Parameters:
  `operator` - a `IASTPointerOperator` to be added.

### getNestedDeclarator

IASTDeclarator getNestedDeclarator()
If the declarator is nested in parentheses, returns the declarator as found in those parentheses.

Returns:
  the nested declarator or null

### setNestedDeclarator

void setNestedDeclarator(IASTDeclarator nested)

### getName

IASTName getName()
Returns the name of the declarator. If this is an abstract declarator, this will return an empty name.

Returns:
  the name of the declarator

### setName

void setName(IASTName name)
Sets the name of he declarator.

Parameters:
  `name` - `IASTName`

### getInitializer

IASTInitializer getInitializer()
Returns the optional initializer for this declarator.

Returns:
  the initializer expression or null

### setInitializer

void setInitializer(IASTInitializer initializer)
Set the optional initializer.

Parameters:
  `initializer` - `IASTInitializer`

### copy

IASTDeclarator copy()
Description copied from interface: `IASTNode`
Returns a mutable copy of the tree rooted at this node. The following postconditions hold:

     copy.getParent() == null
     copy.getPropertyInParent() == null
     copy.isFrozen() == false

Preprocessor nodes do not currently support being copied. Implicit name nodes are not copied, instead they can be regenerated if required.

Calling this method is equivalent to `copy(CopyStyle.withoutLocations)`.

Specified by:
  `copy` in interface `IASTNode`
Since:
  5.1

### copy

IASTDeclarator copy(IASTNode.CopyStyle style)
Description copied from interface: `IASTNode`
Returns a mutable copy of the tree rooted at this node. The following postconditions hold:

     copy.getParent() == null
     copy.getPropertyInParent() == null
     copy.isFrozen() == false

Preprocessor nodes do not currently support being copied. Implicit name nodes are not copied, instead they can be regenerated if required.

Specified by:
  `copy` in interface `IASTNode`
Parameters:
  `style` - `IASTNode.CopyStyle` create a copy with or without locations. Please see `IASTNode.CopyStyle` for restrictions on copies with Locations.
Since:
  5.3