1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Add JavaDoc.

Formatted public interfaces.
Restructured some public interfaces.
This commit is contained in:
John Camelon 2005-03-12 19:08:58 +00:00
parent 35791e2486
commit c0a8eb9c01
22 changed files with 420 additions and 137 deletions

View file

@ -16,9 +16,26 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
/**
* This subclass of ASTVisitor that allows for better control in traversing C.
*
* @ref ASTVisitor
* @author jcamelon
*/
public abstract class CASTVisitor extends ASTVisitor {
public boolean shouldVisitDesignators = false;
public int visit( ICASTDesignator designator ) { return PROCESS_CONTINUE; }
/**
* Override this value in your subclass if you do wish to visit designators.
*/
public boolean shouldVisitDesignators = false;
/**
* Function to override if you wish to visit designators in your
* implementation.
*
* @param designator
* @return
*/
public int visit(ICASTDesignator designator) {
return PROCESS_CONTINUE;
}
}

View file

@ -13,13 +13,33 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
/**
* C-style array designator. e.g. struct ABC { int def[10] }; struct ABC
* instance = { def[0] = 9 };
*
* @author jcamelon
*/
public interface ICASTArrayDesignator extends ICASTDesignator {
public static final ASTNodeProperty SUBSCRIPT_EXPRESSION = new ASTNodeProperty( "Subscript Expression" ); //$NON-NLS-1$
public IASTExpression getSubscriptExpression();
public void setSubscriptExpression( IASTExpression value );
/**
* <code>SUBSCRIPT_EXPRESSION</code> represents the relationship between
* the designator and the subscript expression.
*/
public static final ASTNodeProperty SUBSCRIPT_EXPRESSION = new ASTNodeProperty(
"Subscript Expression"); //$NON-NLS-1$
/**
* Get the subsript expression.
*
* @return value <code>IASTExpression</code>
*/
public IASTExpression getSubscriptExpression();
/**
* Set the subscript expression.
*
* @param value
* <code>IASTExpression</code>
*/
public void setSubscriptExpression(IASTExpression value);
}

View file

@ -12,19 +12,85 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
/**
* This interface represents the role of a C array modifier. C allows for
* modifiers (const, restrict, etc.) as well as variable sized arrays.
*
* @author jcamelon
*/
public interface ICASTArrayModifier extends IASTArrayModifier {
public boolean isConst();
public boolean isStatic();
public boolean isRestrict();
public boolean isVolatile();
public void setConst( boolean value );
public void setVolatile( boolean value );
public void setRestrict( boolean value );
public void setStatic( boolean value );
public boolean isVariableSized();
public void setVariableSized( boolean value );
/**
* Is the const modifier used?
*
* @return boolean
*/
public boolean isConst();
/**
* Is the static modifier used?
*
* @return boolean
*/
public boolean isStatic();
/**
* Is the restrict modifier used?
*
* @return boolean
*/
public boolean isRestrict();
/**
* Is the volatile modifier used?
*
* @return boolean
*/
public boolean isVolatile();
/**
* Set true/false that the const modifier is used.
*
* @param value
* boolean
*/
public void setConst(boolean value);
/**
* Set true/false that the volatile modifier is used.
*
* @param value
* boolean
*/
public void setVolatile(boolean value);
/**
* Set true/false that the restrict modifier is used.
*
* @param value
* boolean
*/
public void setRestrict(boolean value);
/**
* Set true/false that the static modifier is used.
*
* @param value
* boolean
*/
public void setStatic(boolean value);
/**
* Is the array variable sized? ( used ... )
*
* @return boolean
*/
public boolean isVariableSized();
/**
* Set the array to be variable sized dependent upon value.
*
* @param value
* boolean
*/
public void setVariableSized(boolean value);
}

View file

@ -12,9 +12,11 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
/**
* Structs and Unions in C can be qualified w/restrict keyword.
*
* @author jcamelon
*/
public interface ICASTCompositeTypeSpecifier extends
IASTCompositeTypeSpecifier, ICASTDeclSpecifier {
IASTCompositeTypeSpecifier, ICASTDeclSpecifier {
}

View file

@ -13,13 +13,24 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
/**
* C extension to IASTDeclSpecifier. (restrict keyword)
*
* @author Doug Schaefer
*/
public interface ICASTDeclSpecifier extends IASTDeclSpecifier {
// Extra type qualifier in C
/**
* Is restrict keyword used?
*
* @return boolean
*/
public boolean isRestrict();
public void setRestrict( boolean value );
/**
* Set restrict to value.
*
* @param value
*/
public void setRestrict(boolean value);
}

View file

@ -14,17 +14,62 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
/**
* This interface represents a designated initializer. e.g. struct x y = { .z=4,
* .t[1] = 3 };
*
* @author jcamelon
*
*/
public interface ICASTDesignatedInitializer extends
IASTInitializer {
public interface ICASTDesignatedInitializer extends IASTInitializer {
public static final ICASTDesignator [] EMPTY_DESIGNATOR_ARRAY = new ICASTDesignator[0];
public static final ASTNodeProperty DESIGNATOR = new ASTNodeProperty( "Designator"); //$NON-NLS-1$
public void addDesignator( ICASTDesignator designator );
public ICASTDesignator [] getDesignators();
public static final ASTNodeProperty OPERAND = new ASTNodeProperty( "RHS Initializer"); //$NON-NLS-1$
public IASTInitializer getOperandInitializer();
public void setOperandInitializer( IASTInitializer rhs );
/**
* Constant.
*/
public static final ICASTDesignator[] EMPTY_DESIGNATOR_ARRAY = new ICASTDesignator[0];
/**
* <code>DESIGNATOR</code> represents the relationship between an
* <code>ICASTDesignatedInitializer</code> and
* <code>ICASTDesignator</code>.
*/
public static final ASTNodeProperty DESIGNATOR = new ASTNodeProperty(
"Designator"); //$NON-NLS-1$
/**
* Add a designator to this initializer.
*
* @param designator
* <code>ICASTDesignator</code>
*/
public void addDesignator(ICASTDesignator designator);
/**
* Get all of the designators.
*
* @return <code>ICASTDesignator []</code>
*/
public ICASTDesignator[] getDesignators();
/**
* <code>OPERAND</code> represents the relationship between
* <code>ICASTDesignatedInitializer</code> and its
* <code>IASTInitializer</code>.
*/
public static final ASTNodeProperty OPERAND = new ASTNodeProperty(
"RHS Initializer"); //$NON-NLS-1$
/**
* Get the nested initializer.
*
* @return <code>IASTInitializer</code>
*/
public IASTInitializer getOperandInitializer();
/**
* Set the nested initializer.
*
* @param rhs
* <code>IASTInitializer</code>
*/
public void setOperandInitializer(IASTInitializer rhs);
}

View file

@ -12,10 +12,10 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTNode;
/**
* Base interface for all C-style designators.
*
* @author jcamelon
*/
public interface ICASTDesignator extends IASTNode {
}

View file

@ -12,9 +12,12 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
/**
* C's elaborated type specifier. (same as IASTElaboratedTypeSpecifier, except
* for the addition of the restrict keyword.
*
* @author jcamelon
*/
public interface ICASTElaboratedTypeSpecifier extends
IASTElaboratedTypeSpecifier, ICASTDeclSpecifier {
IASTElaboratedTypeSpecifier, ICASTDeclSpecifier {
}

View file

@ -12,9 +12,11 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
/**
* C Enumeration decl specifier. Allows for "restrict enum X { a, b, c };
*
* @author jcamelon
*/
public interface ICASTEnumerationSpecifier extends ICASTDeclSpecifier,
IASTEnumerationSpecifier {
IASTEnumerationSpecifier {
}

View file

@ -13,12 +13,31 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTName;
/**
* Specific Designator that represents a field reference.
*
* @author jcamelon
*/
public interface ICASTFieldDesignator extends ICASTDesignator {
public static final ASTNodeProperty FIELD_NAME = new ASTNodeProperty( "Designator Field Name"); //$NON-NLS-1$
public IASTName getName();
public void setName( IASTName name );
/**
* <code>FIELD_NAME</code> represent the relationship between an
* <code>ICASTFieldDesignator</code> and an <code>IASTName</code>.
*/
public static final ASTNodeProperty FIELD_NAME = new ASTNodeProperty(
"Designator Field Name"); //$NON-NLS-1$
/**
* Get the field name.
*
* @return <code>IASTName</code>
*/
public IASTName getName();
/**
* Set the field name.
*
* @param name
* <code>IASTName</code>
*/
public void setName(IASTName name);
}

View file

@ -12,11 +12,24 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTPointer;
/**
* C-specific pointer. (includes restrict modifier).
*
* @author jcamelon
*/
public interface ICASTPointer extends IASTPointer {
boolean isRestrict();
void setRestrict( boolean value );
/**
* Is this a restrict pointer?
*
* @return isRestrict boolean
*/
boolean isRestrict();
/**
* Set this pointer to be restrict pointer.
*
* @param value
*/
void setRestrict(boolean value);
}

View file

@ -17,16 +17,44 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
*
* @author Doug Schaefer
*/
public interface ICASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier, ICASTDeclSpecifier {
public interface ICASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier,
ICASTDeclSpecifier {
// Extra types in C
/**
* <code>t_Bool</code> boolean. e.g. _Bool x;
*/
public static final int t_Bool = IASTSimpleDeclSpecifier.t_last + 1;
/**
* <code>t_Complex</code> complex number. e.g. _Complex t;
*/
public static final int t_Complex = IASTSimpleDeclSpecifier.t_last + 2;
/**
* <code>t_Imaginary</code> complex imaginary number. e.g. _Imaginr
*/
public static final int t_Imaginary = IASTSimpleDeclSpecifier.t_last + 3;
public boolean isLongLong();
public void setLongLong( boolean value );
/**
* <code>t_last</code> is defined for sub-interfaces.
*/
public static final int t_last = t_Imaginary;
// allow for long long's
/**
* Is long long?
*
* @return boolean
*/
public boolean isLongLong();
/**
* Set long long to be 'value'.
*
* @param value
* boolean
*/
public void setLongLong(boolean value);
}

View file

@ -15,16 +15,55 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
/**
* C Expression of the format type-id { initializer }
*
* @author jcamelon
*/
public interface ICASTTypeIdInitializerExpression extends IASTExpression {
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty( "TypeId"); //$NON-NLS-1$
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty( "Initializer"); //$NON-NLS-1$
public IASTTypeId getTypeId();
public void setTypeId( IASTTypeId typeId );
public IASTInitializer getInitializer();
public void setInitializer( IASTInitializer initializer );
/**
* <code>TYPE_ID</code> represents the relationship between an
* <code>ICASTTypeIdInitializerExpression</code> and
* <code>IASTTypeId</code>.
*/
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty("TypeId"); //$NON-NLS-1$
/**
* <code>INITIALIZER</code> represents the relationship between an
* <code>ICASTTypeIdInitializerExpression</code> and
* <code>IASTInitializer</code>.
*/
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty(
"Initializer"); //$NON-NLS-1$
/**
* Get the type-id.
*
* @return <code>IASTTypeId</code>
*/
public IASTTypeId getTypeId();
/**
* Set the typeId.
*
* @param typeId
* <code>IASTTypeId</code>
*/
public void setTypeId(IASTTypeId typeId);
/**
* Get the initializer.
*
* @return <code>IASTInitializer</code>
*/
public IASTInitializer getInitializer();
/**
* Set the initializer.
*
* @param initializer
* <code>IASTInitializer</code>
*/
public void setInitializer(IASTInitializer initializer);
}

View file

@ -12,9 +12,12 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
/**
* This interface is just as an IASTNamedTypeSpecifier, except that it also
* includes the abiliy to use the restrict modifier.
*
* @author jcamelon
*/
public interface ICASTTypedefNameSpecifier extends IASTNamedTypeSpecifier,
ICASTDeclSpecifier {
ICASTDeclSpecifier {
}

View file

@ -18,8 +18,12 @@ import org.eclipse.cdt.core.dom.ast.IArrayType;
*/
public interface ICArrayType extends IArrayType {
public boolean isConst() throws DOMException;
public boolean isRestrict() throws DOMException;
public boolean isVolatile() throws DOMException;
public boolean isStatic() throws DOMException;
public boolean isVariableLength() throws DOMException;
}

View file

@ -22,8 +22,10 @@ import org.eclipse.cdt.core.dom.ast.IBasicType;
public interface ICBasicType extends IBasicType {
// Extra types in C
public static final int t_Bool = ICASTSimpleDeclSpecifier.t_Bool;
public static final int t_Complex = ICASTSimpleDeclSpecifier.t_Complex;
public static final int t_Imaginary = ICASTSimpleDeclSpecifier.t_Imaginary;
public boolean isLongLong() throws DOMException;
}

View file

@ -21,12 +21,13 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
* @author aniefer
*/
public interface ICCompositeTypeScope extends ICScope {
/**
* get the binding for the member that has been previous added to this scope
* and that matches the given name.
* @param name
* @return
* @throws DOMException
*/
public IBinding getBinding( char[] name ) throws DOMException;
/**
* get the binding for the member that has been previous added to this scope
* and that matches the given name.
*
* @param name
* @return
* @throws DOMException
*/
public IBinding getBinding(char[] name) throws DOMException;
}

View file

@ -17,10 +17,10 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IBinding;
/**
* This interface represents a binding for a function or variable that
* is assumed to exist in another compilation unit and that would be found
* at link time.
*
* This interface represents a binding for a function or variable that is
* assumed to exist in another compilation unit and that would be found at link
* time.
*
* @author aniefer
*/
public interface ICExternalBinding extends IBinding {

View file

@ -22,22 +22,23 @@ import org.eclipse.cdt.core.dom.ast.IScope;
* @author aniefer
*/
public interface ICFunctionScope extends ICScope {
/**
* Get the scope representing the function body .
* returns null if there is no function definition
* @return
* @throws DOMException
*/
public IScope getBodyScope() throws DOMException;
/**
* return the ILabel binding in this scope that matches the given name
*
* @param name
* @return
* @throws DOMException
*/
public IBinding getBinding( char[] name ) throws DOMException;
/**
* Get the scope representing the function body . returns null if there is
* no function definition
*
* @return
* @throws DOMException
*/
public IScope getBodyScope() throws DOMException;
/**
* return the ILabel binding in this scope that matches the given name
*
* @param name
* @return
* @throws DOMException
*/
public IBinding getBinding(char[] name) throws DOMException;
}

View file

@ -20,10 +20,11 @@ import org.eclipse.cdt.core.dom.ast.IPointerType;
* @author aniefer
*/
public interface ICPointerType extends IPointerType {
/**
* is this a restrict pointer
* @return
*/
boolean isRestrict();
/**
* is this a restrict pointer
*
* @return
*/
boolean isRestrict();
}

View file

@ -20,9 +20,10 @@ import org.eclipse.cdt.core.dom.ast.IQualifierType;
* @author aniefer
*/
public interface ICQualifierType extends IQualifierType {
/**
* is this a restrict type
* @return
*/
public boolean isRestrict();
/**
* is this a restrict type
*
* @return
*/
public boolean isRestrict();
}

View file

@ -22,38 +22,43 @@ import org.eclipse.cdt.core.dom.ast.IScope;
* @author aniefer
*/
public interface ICScope extends IScope {
/**
* ISO C:99 6.2.3
* there are seperate namespaces for various categories of identifiers:
* - label names ( labels have ICFunctionScope )
* - tags of structures or unions : NAMESPACE_TYPE_TAG
* - members of structures or unions ( members have ICCompositeTypeScope )
* - all other identifiers : NAMESPACE_TYPE_OTHER
*/
public static final int NAMESPACE_TYPE_TAG = 0;
public static final int NAMESPACE_TYPE_OTHER = 1;
/**
* add a binding to this scope
* @param binding
* @throws DOMException
*/
void addBinding( IBinding binding ) throws DOMException;
/**
* remove the given binding from this scope
* @param binding
* @throws DOMException
*/
void removeBinding( IBinding binding ) throws DOMException;
/**
* Get the binding that has previously been added to this scope that matches
* the given name and is in the appropriate namespace
* @param namespaceType : either NAMESPACE_TYPE_TAG or NAMESPACE_TYPE_OTHER
* @param name
* @return
* @throws DOMException
*/
public IBinding getBinding( int namespaceType, char [] name ) throws DOMException;
/**
* ISO C:99 6.2.3 there are seperate namespaces for various categories of
* identifiers: - label names ( labels have ICFunctionScope ) - tags of
* structures or unions : NAMESPACE_TYPE_TAG - members of structures or
* unions ( members have ICCompositeTypeScope ) - all other identifiers :
* NAMESPACE_TYPE_OTHER
*/
public static final int NAMESPACE_TYPE_TAG = 0;
public static final int NAMESPACE_TYPE_OTHER = 1;
/**
* add a binding to this scope
*
* @param binding
* @throws DOMException
*/
void addBinding(IBinding binding) throws DOMException;
/**
* remove the given binding from this scope
*
* @param binding
* @throws DOMException
*/
void removeBinding(IBinding binding) throws DOMException;
/**
* Get the binding that has previously been added to this scope that matches
* the given name and is in the appropriate namespace
*
* @param namespaceType :
* either NAMESPACE_TYPE_TAG or NAMESPACE_TYPE_OTHER
* @param name
* @return
* @throws DOMException
*/
public IBinding getBinding(int namespaceType, char[] name)
throws DOMException;
}