|
|
|
@ -8,37 +8,22 @@ using NativeLibrary = CppSharp.Parser.AST.NativeLibrary;
@@ -8,37 +8,22 @@ using NativeLibrary = CppSharp.Parser.AST.NativeLibrary;
|
|
|
|
|
|
|
|
|
|
namespace CppSharp |
|
|
|
|
{ |
|
|
|
|
public class ClangParser |
|
|
|
|
public static class ClangParser |
|
|
|
|
{ |
|
|
|
|
/// <summary>
|
|
|
|
|
/// Context with translation units ASTs.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ASTContext ASTContext { get; private set; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Fired when source files are parsed.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Action<IEnumerable<string>, ParserResult> SourcesParsed = delegate {}; |
|
|
|
|
public static Action<IEnumerable<string>, ParserResult> SourcesParsed = delegate {}; |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Fired when library files are parsed.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Action<string, ParserResult> LibraryParsed = delegate {}; |
|
|
|
|
|
|
|
|
|
public ClangParser() |
|
|
|
|
{ |
|
|
|
|
ASTContext = new ASTContext(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ClangParser(ASTContext context) |
|
|
|
|
{ |
|
|
|
|
ASTContext = context; |
|
|
|
|
} |
|
|
|
|
public static Action<string, ParserResult> LibraryParsed = delegate {}; |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Parses a C++ source file as a translation unit.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ParserResult ParseSourceFile(string file, ParserOptions options) |
|
|
|
|
public static ParserResult ParseSourceFile(string file, ParserOptions options) |
|
|
|
|
{ |
|
|
|
|
return ParseSourceFiles(new [] { file }, options); |
|
|
|
|
} |
|
|
|
@ -46,9 +31,9 @@ namespace CppSharp
@@ -46,9 +31,9 @@ namespace CppSharp
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Parses a set of C++ source files as a single translation unit.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ParserResult ParseSourceFiles(IEnumerable<string> files, ParserOptions options) |
|
|
|
|
public static ParserResult ParseSourceFiles(IEnumerable<string> files, ParserOptions options) |
|
|
|
|
{ |
|
|
|
|
options.ASTContext = ASTContext; |
|
|
|
|
options.ASTContext = new ASTContext(); |
|
|
|
|
|
|
|
|
|
foreach (var file in files) |
|
|
|
|
options.AddSourceFiles(file); |
|
|
|
@ -62,7 +47,7 @@ namespace CppSharp
@@ -62,7 +47,7 @@ namespace CppSharp
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Parses a library file with symbols.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ParserResult ParseLibrary(string file, ParserOptions options) |
|
|
|
|
public static ParserResult ParseLibrary(string file, ParserOptions options) |
|
|
|
|
{ |
|
|
|
|
options.LibraryFile = file; |
|
|
|
|
|
|
|
|
|