blob: 9a636dfec855c7a948a0eadd57421fdac3d63de6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/**********************************************************************
* Copyright (c) 2002-2004 IBM Canada and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICBasicType;
/**
* @author dsteffle
*/
public class CBasicType implements ICBasicType {
private ICASTSimpleDeclSpecifier sds = null;
/**
* keep a reference to the declaration specifier so that duplicate information isn't generated.
*
* @param sds the simple declaration specifier
*/
public CBasicType(ICASTSimpleDeclSpecifier sds) {
this.sds = sds;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBasicType#getType()
*/
public int getType() {
return sds.getType();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBasicType#isSigned()
*/
public boolean isSigned() {
return sds.isSigned();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBasicType#isUnsigned()
*/
public boolean isUnsigned() {
return sds.isUnsigned();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBasicType#isShort()
*/
public boolean isShort() {
return sds.isShort();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBasicType#isLong()
*/
public boolean isLong() {
return sds.isLong();
}
public boolean isLongLong() {
return sds.isLongLong();
}
public boolean isSameType(IType obj) {
if( obj == this )
return true;
if( obj instanceof ITypedef )
return obj.isSameType( this );
if (!(obj instanceof CBasicType)) return false;
CBasicType cObj = (CBasicType)obj;
return (cObj.getType() == this.getType()
&& cObj.isLong() == this.isLong()
&& cObj.isShort() == this.isShort()
&& cObj.isSigned() == this.isSigned()
&& cObj.isUnsigned() == this.isUnsigned()
&& cObj.isLongLong() == this.isLongLong());
}
public Object clone(){
IType t = null;
try {
t = (IType) super.clone();
} catch ( CloneNotSupportedException e ) {
//not going to happen
}
return t;
}
}
|