From 3b8838d4bc288ea3f51f9393b4ba76244ac6f0e8 Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Fri, 10 Dec 2004 17:03:16 +0000 Subject: [PATCH] Interfaces for basic types --- .../eclipse/cdt/core/dom/ast/IBasicType.java | 20 ++++++++++++ .../cdt/core/dom/ast/c/ICBasicType.java | 28 +++++++++++++++++ .../cdt/core/dom/ast/cpp/ICPPBasicType.java | 25 +++++++++++++++ .../core/dom/ast/gnu/cpp/IGPPBasicType.java | 31 +++++++++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICBasicType.java create mode 100644 core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPBasicType.java create mode 100644 core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/IGPPBasicType.java diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java index 92f4fb48d11..0ba852151ee 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java @@ -19,4 +19,24 @@ package org.eclipse.cdt.core.dom.ast; */ public interface IBasicType extends IType { + /** + * This returns the built-in type for the declaration. The type is + * then refined by qualifiers for signed/unsigned and short/long. + * The type could also be unspecified which usually means int. + * + * @return + */ + public int getType(); + + public static final int t_unspecified = IASTSimpleDeclSpecifier.t_unspecified; + public static final int t_void = IASTSimpleDeclSpecifier.t_void; + public static final int t_char = IASTSimpleDeclSpecifier.t_char; + public static final int t_int = IASTSimpleDeclSpecifier.t_int; + public static final int t_float = IASTSimpleDeclSpecifier.t_float; + public static final int t_double = IASTSimpleDeclSpecifier.t_double; + + public boolean isSigned(); + public boolean isUnsigned(); + public boolean isShort(); + public boolean isLong(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICBasicType.java new file mode 100644 index 00000000000..db20679da7b --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICBasicType.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +/* + * Created on Dec 10, 2004 + */ +package org.eclipse.cdt.core.dom.ast.c; + +import org.eclipse.cdt.core.dom.ast.IBasicType; + +/** + * @author aniefer + */ +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(); +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPBasicType.java new file mode 100644 index 00000000000..d30857127c5 --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPBasicType.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +/* + * Created on Dec 10, 2004 + */ +package org.eclipse.cdt.core.dom.ast.cpp; + +import org.eclipse.cdt.core.dom.ast.IBasicType; + +/** + * @author aniefer + */ +public interface ICPPBasicType extends IBasicType { + //Extra types + public static final int t_bool = ICPPASTSimpleDeclSpecifier.t_bool; + public static final int t_wchar_t = ICPPASTSimpleDeclSpecifier.t_wchar_t; +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/IGPPBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/IGPPBasicType.java new file mode 100644 index 00000000000..d615f88c838 --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/IGPPBasicType.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +/* + * Created on Dec 10, 2004 + */ +package org.eclipse.cdt.core.dom.ast.gnu.cpp; + +import org.eclipse.cdt.core.dom.ast.IType; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType; + +/** + * @author aniefer + */ +public interface IGPPBasicType extends ICPPBasicType { + + public static final int t_Complex = IGPPASTSimpleDeclSpecifier.t_Complex; + public static final int t_Imaginary = IGPPASTSimpleDeclSpecifier.t_Imaginary; + public static final int t_typeof = IGPPASTSimpleDeclSpecifier.t_typeof; + + public boolean isLongLong(); + + public IType getTypeofType(); +}