private static String buildSizeableArray(Type type, final ParseArrayMode What) { final StringBuffer result = new StringBuffer(); String arraySpec = ""; while (type instanceof ArrayOf) { final String size = ((ArrayOf) type).getSize(); if (size != null) { arraySpec = "[" + size + "]" + arraySpec; } else { arraySpec = "[]" + arraySpec; } type = getContainedType((ArrayOf) type); } if (What == ParseArrayMode.TYPE) result.append(buildComplexOrPrimitiveType(type)); if (What == ParseArrayMode.SIZEOF) result.append(arraySpec); return result.toString(); }
private static String buildSizeableArray(Type type, final ParseArrayMode What) { final StringBuffer result = new StringBuffer(); String arraySpec = ""; while (type instanceof ArrayOf) { final String size = ((ArrayOf) type).getSize(); if (size != null) { arraySpec = "[" + size + "]" + arraySpec; } else { arraySpec = "[]" + arraySpec; } type = getContainedType((ArrayOf) type); } if (What == ParseArrayMode.TYPE) result.append(buildComplexOrPrimitiveType(type)); if (What == ParseArrayMode.SIZEOF) result.append(arraySpec); return result.toString(); }
private static String buildSizeableArray(Type type, final ParseArrayMode What) { final StringBuffer result = new StringBuffer(); String arraySpec = ""; while (type instanceof ArrayOf) { final String size = ((ArrayOf) type).getSize(); if (size != null) { arraySpec = "[" + size + "]" + arraySpec; } else { arraySpec = "[]" + arraySpec; } type = getContainedType((ArrayOf) type); } if (What == ParseArrayMode.TYPE) result.append(buildComplexOrPrimitiveType(type)); if (What == ParseArrayMode.SIZEOF) result.append(arraySpec); return result.toString(); }
private static String buildSizeableArray(Type type, final ParseArrayMode What) { final StringBuffer result = new StringBuffer(); String arraySpec = ""; while (type instanceof ArrayOf) { final String size = ((ArrayOf) type).getSize(); if (size != null) { arraySpec = "[" + size + "]" + arraySpec; } else { arraySpec = "[]" + arraySpec; } type = getContainedType((ArrayOf) type); } if (What == ParseArrayMode.TYPE) result.append(buildComplexOrPrimitiveType(type)); if (What == ParseArrayMode.SIZEOF) result.append(arraySpec); return result.toString(); }
/** * Returns the equivalent in C of the given return type. * * @param type the type * @return the equivalent in C of the given return type. */ public static String buildType(Type type) { final StringBuffer result = new StringBuffer(); int nbPointer = 0; // A return type is an [ArrayOf](PointerOf)*(PrimitiveType|ComplexType) while (type instanceof ArrayOf) { nbPointer++; type = getContainedType((ArrayOf) type); } while (type instanceof PointerOf) { nbPointer++; type = getContainedType((PointerOf) type); } result.append(buildComplexOrPrimitiveType(type)); for (int i = 0; i < nbPointer; i++) result.append('*'); return result.toString(); }