return result.toString();
}
+ /**
+ * Returns a string representation for the parameters and the qualifiers of the given function type.
+ * The representation contains the comma-separated list of the normalized parameter
+ * type representations wrapped in parentheses followed by the method qualifiers, if any.
+ *
+ * @since 5.11
+ */
+ public static String getParameterTypeStringAndQualifiers(IFunctionType type) {
+ StringBuilder result = new StringBuilder();
+ appendParameterTypeStringAndQualifiers(type, result);
+ return result.toString();
+ }
+
private static void appendParameterTypeString(IFunctionType ft, StringBuilder result) {
IType[] types = ft.getParameterTypes();
result.append(Keywords.cpLPAREN);
result.append(Keywords.cpRPAREN);
}
+ private static boolean appendParameterTypeStringAndQualifiers(IFunctionType ft, StringBuilder result) {
+ appendParameterTypeString(ft, result);
+ boolean needSpace = false;
+ if (ft instanceof ICPPFunctionType) {
+ ICPPFunctionType cppft= (ICPPFunctionType) ft;
+ needSpace= appendCVQ(result, needSpace, cppft.isConst(), cppft.isVolatile(), false);
+ if (cppft.hasRefQualifier()) {
+ appendRefQualifier(result, needSpace, cppft.isRValueReference()); needSpace = true;
+ }
+ }
+ return needSpace;
+ }
+
/**
* Returns whether the function matching the given function binding takes parameters or not.
*
result.append(SPACE);
appendNameCheckAnonymous((IEnumeration) type, result);
} else if (type instanceof IFunctionType) {
- appendParameterTypeString((IFunctionType) type, result);
- needSpace = false;
- if (type instanceof ICPPFunctionType) {
- ICPPFunctionType ft= (ICPPFunctionType) type;
- needSpace= appendCVQ(result, needSpace, ft.isConst(), ft.isVolatile(), false);
- if (ft.hasRefQualifier()) {
- appendRefQualifier(result, needSpace, ft.isRValueReference()); needSpace = true;
- }
- }
+ needSpace = appendParameterTypeStringAndQualifiers((IFunctionType) type, result);
} else if (type instanceof IPointerType) {
if (type instanceof ICPPPointerToMemberType) {
appendTypeString(((ICPPPointerToMemberType) type).getMemberOfClass(), normalize, result);
ICPPReferenceType ref= null;
while (type != null && ++i < 100) {
if (type instanceof ITypedef) {
- // If normalization was not requested, skip the typedef and proceed with its target
- // type.
+ // If normalization was not requested, skip the typedef and proceed with its target type.
if (!normalize) {
// Output reference, qualifier and typedef, then stop.
if (ref != null) {
/*******************************************************************************
- * Copyright (c) 2004, 2014 IBM Corporation and others.
+ * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
StringBuilder result = new StringBuilder();
result.append(getName());
IFunctionType t = getType();
- result.append(t != null ? ASTTypeUtil.getParameterTypeString(t) : "()"); //$NON-NLS-1$
+ result.append(t != null ? ASTTypeUtil.getParameterTypeStringAndQualifiers(t) : "()"); //$NON-NLS-1$
return result.toString();
}