1
/*******************************************************************************
2
* Copyright (c) 2000, 2006 QNX Software Systems and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* QNX Software Systems - Initial API and implementation
10
*******************************************************************************/
12
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
14
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType;
15
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
16
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
20
public class ArrayType extends DerivedType implements ICDIArrayType {
27
public ArrayType(Target target, String typename,int dim) {
28
super(target, typename);
33
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType#getDimension()
35
public int getDimension() {
36
if (derivedType == null) {
43
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIArrayType#getComponentType()
45
public ICDIType getComponentType() {
46
if (derivedType == null) {
47
String orig = getTypeName();
49
int lbracket = orig.lastIndexOf('[');
50
int rbracket = orig.lastIndexOf(']');
51
if (lbracket != -1 && rbracket != -1 && (rbracket > lbracket)) {
53
String dim = name.substring(lbracket + 1, rbracket).trim();
54
dimension = Integer.parseInt(dim);
55
} catch (NumberFormatException e) {
57
name = orig.substring(0, lbracket).trim();
59
setComponentType(name);