public void GenerateIncludeForwardRefs() { var typeReferenceCollector = new CLITypeReferenceCollector(Driver.TypeDatabase, Driver.Options); typeReferenceCollector.Process(TranslationUnit, filterNamespaces: false); var includes = new SortedSet<string>(StringComparer.InvariantCulture); foreach (var typeRef in typeReferenceCollector.TypeReferences) { if (typeRef.Include.TranslationUnit == TranslationUnit) continue; if (typeRef.Include.File == TranslationUnit.FileName) continue; var include = typeRef.Include; var unit = include.TranslationUnit; if (unit != null && !unit.IsDeclared) continue; if(!string.IsNullOrEmpty(include.File) && include.InHeader) includes.Add(include.ToString()); } foreach (var include in includes) WriteLine(include); }
public void GenerateForwardReferenceHeaders() { PushBlock(BlockKind.IncludesForwardReferences); var typeReferenceCollector = new CLITypeReferenceCollector(Context.TypeMaps, Context.Options); typeReferenceCollector.Process(TranslationUnit, filterNamespaces: false); var includes = new SortedSet <string>(StringComparer.InvariantCulture); foreach (var typeRef in typeReferenceCollector.TypeReferences) { if (typeRef.Include.File == TranslationUnit.FileName) { continue; } var include = typeRef.Include; if (!string.IsNullOrEmpty(include.File) && !include.InHeader) { includes.Add(include.ToString()); } } foreach (var include in includes) { WriteLine(include); } PopBlock(); }
public void GenerateForwardRefs() { var typeReferenceCollector = new CLITypeReferenceCollector(Driver.TypeDatabase); typeReferenceCollector.Process(TranslationUnit); var typeReferences = typeReferenceCollector.TypeReferences; var @namespace = ConvertForwardReferencesToNamespaces(typeReferences); GenerateNamespace(@namespace); }
public void GenerateForwardRefs() { var typeReferenceCollector = new CLITypeReferenceCollector(Context.TypeMaps, Context.Options); typeReferenceCollector.Process(TranslationUnit); var typeReferences = typeReferenceCollector.TypeReferences; var @namespace = ConvertForwardReferencesToNamespaces(typeReferences); GenerateNamespace(@namespace); }
public override void CLITypeReference(CLITypeReferenceCollector collector, ASTRecord<Declaration> loc) { var typeRef = collector.GetTypeReference(loc.Value); var include = new Include { File = "cstddef", Kind = Include.IncludeKind.Angled, }; typeRef.Include = include; }
public void GenerateIncludeForwardRefs() { var typeReferenceCollector = new CLITypeReferenceCollector(Context.TypeMaps, Context.Options); typeReferenceCollector.Process(TranslationUnit, filterNamespaces: false); var includes = new SortedSet <string>(StringComparer.InvariantCulture); foreach (var typeRef in typeReferenceCollector.TypeReferences) { if (typeRef.Include.TranslationUnit == TranslationUnit) { continue; } if (typeRef.Include.File == TranslationUnit.FileName) { continue; } var include = typeRef.Include; var unit = include.TranslationUnit; if (unit != null && !unit.IsDeclared) { continue; } if (!string.IsNullOrEmpty(include.File) && include.InHeader) { includes.Add(include.ToString()); } } foreach (var include in includes) { WriteLine(include); } }
public void GenerateForwardRefs(Namespace @namespace) { var typeReferenceCollector = new CLITypeReferenceCollector(Driver.TypeDatabase); typeReferenceCollector.Process(@namespace); // Use a set to remove duplicate entries. var forwardRefs = new SortedSet <string>(StringComparer.InvariantCulture); foreach (var typeRef in typeReferenceCollector.TypeReferences) { var @ref = typeRef.FowardReference; if (!string.IsNullOrEmpty(@ref) && !typeRef.Include.InHeader) { forwardRefs.Add(@ref); } } foreach (var forwardRef in forwardRefs) { WriteLine(forwardRef); } }
public void GenerateForwardRefs() { var typeReferenceCollector = new CLITypeReferenceCollector(Driver.TypeDatabase, Driver.Options); typeReferenceCollector.Process(TranslationUnit); var typeReferences = typeReferenceCollector.TypeReferences; var @namespace = ConvertForwardReferencesToNamespaces(typeReferences); GenerateNamespace(@namespace); }
public virtual void CLITypeReference(CLITypeReferenceCollector collector, ASTRecord<Declaration> loc) { }
public override void CLITypeReference(CLITypeReferenceCollector collector, ASTRecord<Declaration> loc) { if(!(Declaration is ClassTemplate)) return; var typeRef = collector.GetTypeReference(Declaration); typeRef.Include = new Include() { File = "ResourceHandle.h", Kind = Include.IncludeKind.Quoted, InHeader = true }; Debug.Assert(loc.Parent != null); var type = loc.Parent.Object as CppSharp.AST.Type; var templateType = type.Desugar() as TemplateSpecializationType; var tag = templateType.Arguments[0].Type.Type as TagType; if(tag == null) return; // TODO Fix this var argDecl = tag.Declaration; var argTypeDef = collector.GetTypeReference(argDecl); argTypeDef.Include = new Include() { File = argDecl.Namespace.TranslationUnit.FileName, Kind = Include.IncludeKind.Quoted, InHeader = true }; }
public override void CLITypeReference(CLITypeReferenceCollector collector, ASTRecord<Declaration> loc) { var typeRef = collector.GetTypeReference(Declaration); typeRef.Include = new Include() { File = "StringConverter.h", Kind = Include.IncludeKind.Quoted, InHeader = true }; }