1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-26 18:35:32 +02:00

Added toString method.

This commit is contained in:
Sergey Prigogin 2008-02-04 06:29:50 +00:00
parent 8a38316b33
commit cd0bd1eebb
2 changed files with 81 additions and 68 deletions

View file

@ -13,6 +13,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@ -51,9 +52,11 @@ import org.eclipse.cdt.internal.core.index.IIndexType;
* @author aniefer * @author aniefer
*/ */
public class CPPClassTemplate extends CPPTemplateDefinition implements public class CPPClassTemplate extends CPPTemplateDefinition implements
ICPPClassTemplate, ICPPClassType, ICPPInternalClassType, ICPPInternalClassTemplate, ICPPInternalClassTypeMixinHost { ICPPClassTemplate, ICPPClassType, ICPPInternalClassType, ICPPInternalClassTemplate,
ICPPInternalClassTypeMixinHost {
public static class CPPClassTemplateDelegate extends CPPClassType.CPPClassTypeDelegate implements ICPPClassTemplate, ICPPInternalClassTemplate { public static class CPPClassTemplateDelegate extends CPPClassType.CPPClassTypeDelegate
implements ICPPClassTemplate, ICPPInternalClassTemplate {
public CPPClassTemplateDelegate(ICPPUsingDeclaration usingDecl, ICPPClassType cls) { public CPPClassTemplateDelegate(ICPPUsingDeclaration usingDecl, ICPPClassType cls) {
super(usingDecl, cls); super(usingDecl, cls);
} }
@ -111,8 +114,7 @@ ICPPClassTemplate, ICPPClassType, ICPPInternalClassType, ICPPInternalClassTempla
} }
if (name.getParent() instanceof ICPPASTCompositeTypeSpecifier && if (name.getParent() instanceof ICPPASTCompositeTypeSpecifier &&
CharArrayUtils.equals( c, nameArray ) ) CharArrayUtils.equals(c, nameArray)) {
{
IBinding binding = name.resolveBinding(); IBinding binding = name.resolveBinding();
if (binding == CPPClassTemplate.this) { if (binding == CPPClassTemplate.this) {
if (name instanceof ICPPASTQualifiedName) { if (name instanceof ICPPASTQualifiedName) {
@ -223,8 +225,6 @@ ICPPClassTemplate, ICPPClassType, ICPPInternalClassType, ICPPInternalClassTempla
return ICPPASTElaboratedTypeSpecifier.k_class; return ICPPASTElaboratedTypeSpecifier.k_class;
} }
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() { public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
partialSpecializations = (ICPPClassTemplatePartialSpecialization[]) ArrayUtil.trim(ICPPClassTemplatePartialSpecialization.class, partialSpecializations); partialSpecializations = (ICPPClassTemplatePartialSpecialization[]) ArrayUtil.trim(ICPPClassTemplatePartialSpecialization.class, partialSpecializations);
return partialSpecializations; return partialSpecializations;
@ -234,8 +234,6 @@ ICPPClassTemplate, ICPPClassType, ICPPInternalClassType, ICPPInternalClassTempla
return new CPPClassTemplateDelegate(usingDecl, this); return new CPPClassTemplateDelegate(usingDecl, this);
} }
/* */
public boolean isSameType(IType type) { public boolean isSameType(IType type) {
if (type == this) if (type == this)
return true; return true;
@ -295,4 +293,11 @@ ICPPClassTemplate, ICPPClassType, ICPPInternalClassType, ICPPInternalClassTempla
} }
return null; return null;
} }
/* (non-Javadoc)
* For debug purposes only
*/
public String toString() {
return ASTTypeUtil.getType(this);
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2007 IBM Corporation and others. * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,6 +13,7 @@
*/ */
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
@ -44,4 +45,11 @@ public abstract class CPPInstance extends CPPSpecialization implements ICPPTempl
public IType[] getArguments() { public IType[] getArguments() {
return arguments; return arguments;
} }
/* (non-Javadoc)
* For debug purposes only
*/
public String toString() {
return getName() + " <" + ASTTypeUtil.getTypeListString(arguments) + ">"; //$NON-NLS-1$ //$NON-NLS-2$
}
} }