public override void PrintTo(ICodePrinter printer, ILogPrinter logPrinter, PrintFlags flags) { Debug.Assert(printer != null && logPrinter != null); base.PrintTo(printer, logPrinter, flags); switch (arrayKind) { case ArrayKind.Invalid: { // void */PVOID PrimitiveNativeType.PrintNameTo(TypeName.Void, 1, printer, flags); break; } case ArrayKind.SafeArray: { // prefix with const if in-only if (isInOnly) { printer.Print(OutputType.Keyword, "const"); printer.Print(OutputType.Other, " "); } // SAFEARRAY * or LPSAFEARRAY if ((flags & PrintFlags.UsePlainC) == PrintFlags.UsePlainC) { TypeName.PrintTo(printer, TypeName.SafeArray.PlainC); printer.Print(OutputType.Other, " "); printer.Print(OutputType.Operator, "*"); } else { TypeName.PrintTo(printer, "LP" + TypeName.SafeArray.WinApi); } break; } default: { elementType.PrintTo(printer, logPrinter, flags); break; } } if (indirections > 0) { // We'll suppress the [] suffix in this case; one indirection will be provided by the // element itself because the ByRefParam flag has been inherited by it. int stars = indirections; while (stars-- > 0) { printer.Print(OutputType.Operator, "*"); } } }
protected internal static void PrintNameTo(TypeName typeName, int indirections, ICodePrinter printer, PrintFlags flags) { string output; if ((flags & PrintFlags.UsePlainC) == PrintFlags.UsePlainC) { output = typeName.PlainC; } else { output = typeName.WinApi; if (indirections > 0) { switch (typeName.PointerPrefix) { case TypeName.PtrPrefix.P_Prefix: { output = "P" + output; indirections--; break; } case TypeName.PtrPrefix.LP_Prefix: { output = "LP" + output; indirections--; break; } } } } TypeName.PrintTo(printer, output); if (indirections > 0) { if (!output.EndsWith("*")) { printer.Print(OutputType.Other, " "); } while (indirections-- > 0) { printer.Print(OutputType.Operator, "*"); } } }