using System.Collections.Generic; using CppSharp.AST; using CppSharp.Parser; namespace CppSharp { /// /// Represents a reference to a source file. /// public class SourceFile { /// /// Gets the file name. /// public string Name { get { return System.IO.Path.GetFileName(Path); } } /// /// Gets the file path. /// public string Path { get; private set; } /// /// Gets/sets the parser options for the file. /// public ParserOptions Options { get; set; } /// /// Gets/sets the AST representation of the file. /// public TranslationUnit Unit { get; set; } public SourceFile(string path) { Path = path; } public override string ToString() { return Path; } } /// /// Represents a C++ project with source and library files. /// public class Project { /// /// List of per-project C/C++ preprocessor defines. /// public IList Defines { get; private set; } /// /// List of per-project C/C++ include directories. /// public IList IncludeDirs { get; private set; } /// /// List of per-project C/C++ system include directories. /// public IList SystemIncludeDirs { get; private set; } /// /// List of source files in the project. /// public IList Sources { get; private set; } /// /// Main AST context with translation units for the sources. /// public ASTContext ASTContext { get; private set; } /// /// Main symbols context with indexed library symbols. /// public SymbolContext SymbolsContext { get; private set; } public Project() { Defines = new List(); IncludeDirs = new List(); SystemIncludeDirs = new List(); Sources = new List(); } /// /// Adds a new source file to the project. /// public SourceFile AddFile(string path) { var sourceFile = new SourceFile(path); Sources.Add(sourceFile); return sourceFile; } /// /// Adds a group of source files to the project. /// public void AddFiles(IEnumerable paths) { foreach (var path in paths) AddFile(path); } /// /// Adds a new source file to the project. /// public void AddFolder(string path) { var sourceFile = new SourceFile(path); Sources.Add(sourceFile); } } }