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

# Interface ICPPASTIfStatement

All Superinterfaces:
  `IASTAttributeOwner`, `IASTIfStatement`, `IASTNode`, `IASTStatement`

public interface ICPPASTIfStatement extends IASTIfStatement
The 'if' statement including the optional else clause.

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`
`INIT_STATEMENT`
`INIT_STATEMENT` represents the relationship between an `ICPPASTIfStatement` and its nested `IASTStatement`.

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

`ATTRIBUTE, ATTRIBUTE_SPECIFIER`

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

`CONDITION, ELSE, THEN`

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

`EMPTY_NODE_ARRAY`

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

`EMPTY_STATEMENT_ARRAY`

## Method Summary

Modifier and Type
Method
Description
`ICPPASTIfStatement`
`copy()`
Returns a mutable copy of the tree rooted at this node.
`ICPPASTIfStatement`
`copy(IASTNode.CopyStyle style)`
Returns a mutable copy of the tree rooted at this node.
`IASTDeclaration`
`getConditionDeclaration()`
Returns the condition declaration.
`IASTStatement`
`getInitializerStatement()`
Returns the init-statement for an if.
`IScope`
`getScope()`
Returns the implicit `IScope` represented by this if statement
`boolean`
`isConstexpr()`
Checks whether this if statement is a constexpr if statement.
`void`
`setConditionDeclaration(IASTDeclaration d)`
Sets the condition declaration.
`void`
`setInitializerStatement(IASTStatement statement)`
Sets the optional init-statement of an if.
`void`
`setIsConstexpr(boolean isConstexpr)`
Sets the isConstxpr member variable.

### 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.IASTIfStatement

`getConditionExpression, getElseClause, getThenClause, setConditionExpression, setElseClause, setThenClause`

### 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

### INIT_STATEMENT

static final ASTNodeProperty INIT_STATEMENT
`INIT_STATEMENT` represents the relationship between an `ICPPASTIfStatement` and its nested `IASTStatement`.

Since:
  6.5

## Method Details

### getConditionDeclaration

IASTDeclaration getConditionDeclaration()
Returns the condition declaration. The condition declaration and the condition expression are mutually exclusive.

Returns:
  the condition declaration, or `null` if the 'if' statement doesn't have a condition declaration.

### setConditionDeclaration

void setConditionDeclaration(IASTDeclaration d)
Sets the condition declaration.

### setIsConstexpr

void setIsConstexpr(boolean isConstexpr)
Sets the isConstxpr member variable.

Since:
  6.5

### isConstexpr

boolean isConstexpr()
Checks whether this if statement is a constexpr if statement.

Returns:
  true iff this if statement is a constexpr if.
Since:
  6.5

### getInitializerStatement

IASTStatement getInitializerStatement()
Returns the init-statement for an if.

Returns:
  the init-statement, or `null` if the 'if' statement doesn't have one.
Since:
  6.5

### setInitializerStatement

void setInitializerStatement(IASTStatement statement)
Sets the optional init-statement of an if.

Parameters:
  `statement` - this statement should either be a `IASTSimpleDeclaration` or a `IASTExpressionStatement`.
Since:
  6.5

### getScope

IScope getScope()
Returns the implicit `IScope` represented by this if statement

Returns:
  `IScope`

### copy

ICPPASTIfStatement 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 `IASTIfStatement`
Specified by:
  `copy` in interface `IASTNode`
Specified by:
  `copy` in interface `IASTStatement`
Since:
  5.1

### copy

ICPPASTIfStatement 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 `IASTIfStatement`
Specified by:
  `copy` in interface `IASTNode`
Specified by:
  `copy` in interface `IASTStatement`
Parameters:
  `style` - `IASTNode.CopyStyle` create a copy with or without locations. Please see `IASTNode.CopyStyle` for restrictions on copies with Locations.
Since:
  5.3