xtc.type
Interface Tagged

All Known Implementing Classes:
EnumT, StructOrUnionT, StructT, UnionT

public interface Tagged

The interface of all tagged C types. Note that all tagged C types must have a name, even if they are unnamed in source code. For unnamed tagged types, the name must be of the form tag(nonce).

Version:
$Revision: 1.5 $
Author:
Robert Grimm

Method Summary
 Type getMember(int index)
          Get the member with the specified index.
 int getMemberCount()
          Get the number of members.
 java.util.List<? extends Type> getMembers()
          Get the members of the tagged type.
 java.lang.String getName()
          Get the name.
 Nonce getNonce()
          Get this tagged type's nonce.
 boolean hasName(java.lang.String name)
          Determine whether this tagged type has the specified name.
 boolean isEnum()
          Determine whether this tagged type is an enum.
 boolean isStruct()
          Determine whether this tagged type is a struct.
 boolean isUnion()
          Determine whether this tagged type is a union.
 boolean isUnnamed()
          Determine whether this tagged type is unnamed.
 Type lookup(java.lang.String name)
          Look up the member with the specified name.
 

Method Detail

isEnum

boolean isEnum()
Determine whether this tagged type is an enum.

Returns:
true if this tagged type is an enum.

isStruct

boolean isStruct()
Determine whether this tagged type is a struct.

Returns:
true if this tagged type is a struct.

isUnion

boolean isUnion()
Determine whether this tagged type is a union.

Returns:
true if this tagged type is a union.

getNonce

Nonce getNonce()
Get this tagged type's nonce. The nonce is used to determine equality of tagged types while still allowing for several type instances.

Returns:
The nonce.

isUnnamed

boolean isUnnamed()
Determine whether this tagged type is unnamed. Note that an unnamed tagged type still has a name of the form tag(nonce).

Returns:
true if this tagged type is unnamed.

hasName

boolean hasName(java.lang.String name)
Determine whether this tagged type has the specified name.

Parameters:
name - The name.
Returns:
true if this tagged type has the name.

getName

java.lang.String getName()
Get the name.

Returns:
The name.

lookup

Type lookup(java.lang.String name)
Look up the member with the specified name. If this type is a struct or union and has any unnnamed struct or union fields, this method also tries to look up the name in the unnamed struct or union.

Parameters:
name - The name.
Returns:
The type or ErrorT.TYPE if the tagged type has no such member.

getMemberCount

int getMemberCount()
Get the number of members. For struct and union types, the returned count excludes any anonymous bit-fields. It also excludes the individual members of an unnamed struct or union member.

Returns:
The number of members or -1 if this type is incomplete.

getMember

Type getMember(int index)
Get the member with the specified index. For struct and union types, anonymous bit-fields are not considered.

Parameters:
index - The index.
Returns:
The corresponding member.
Throws:
java.lang.IndexOutOfBoundsException - Signals that the index is out of range.

getMembers

java.util.List<? extends Type> getMembers()
Get the members of the tagged type.

Returns:
The list of members or null if this type is incomplete.


Copyright © 2012. All Rights Reserved.