public override TypePrinterResult VisitClassDecl(Class @class) { if (ContextKind == TypePrinterContextKind.Native) { return($"UnsafeMutablePointer<{CGenerator.QualifiedName(@class)}>!"); } return(VisitDeclaration(@class)); }
public override bool VisitEnumDecl(Enumeration @enum) { if (!VisitDeclaration(@enum)) { return(false); } PushBlock(); var enumName = Options.GeneratorKind != GeneratorKind.CPlusPlus ? CGenerator.QualifiedName(@enum) : @enum.Name; Write($"typedef enum {enumName}"); if (Options.GeneratorKind == GeneratorKind.CPlusPlus) { var typeName = CTypePrinter.VisitPrimitiveType( @enum.BuiltinType.Type, new TypeQualifiers()); if (@enum.BuiltinType.Type != PrimitiveType.Int) { Write($" : {typeName}"); } } NewLine(); WriteStartBraceIndent(); foreach (var item in @enum.Items) { var enumItemName = Options.GeneratorKind != GeneratorKind.CPlusPlus ? $"{@enum.QualifiedName}_{item.Name}" : item.Name; Write(enumItemName); if (item.ExplicitValue) { Write($" = {@enum.GetItemValueAsString(item)}"); } if (item != @enum.Items.Last()) { WriteLine(","); } } NewLine(); PopIndent(); WriteLine($"}} {enumName};"); PopBlock(NewLineKind.BeforeNextBlock); return(true); }
public override string VisitDeclaration(Declaration decl) { var name = base.VisitDeclaration(decl); return(CGenerator.QualifiedName(decl)); }