diff --git a/src/Bridge/Library.cs b/src/Bridge/Library.cs index d2ce1114..0c1ed491 100644 --- a/src/Bridge/Library.cs +++ b/src/Bridge/Library.cs @@ -18,85 +18,85 @@ namespace Cxxi Unavailable } + /// + /// A module represents a parsed C++ translation unit. + /// [DebuggerDisplay("File = {FileName}, Ignored = {Ignore}")] - public class Module + public class Module : Namespace { - public Module(string File) + public Module(string file) { - Global = new Namespace(); Macros = new List(); - Namespaces = new List(); - FilePath = File; + FilePath = file; Ignore = false; } + /// Contains the macros present in the unit. + public List Macros; + + /// If the module should be ignored. public bool Ignore; + + /// Contains the path to the file. public string FilePath; + /// Contains the name of the file. public string FileName { get { return Path.GetFileName(FilePath); } } - - public List Macros; - - public Namespace Global; - public List Namespaces; - - public bool HasDeclarations - { - get - { - return Global.HasDeclarations - || Namespaces.Exists(n => n.HasDeclarations); - } - } } + /// + /// A library contains all the modules. + /// public class Library { + public string Name; + public List Modules; + public Library(string name) { Name = name; Modules = new List(); } - public Module FindOrCreateModule(string File) + /// Finds an existing module or creates a new one given a file path. + public Module FindOrCreateModule(string file) { - var module = Modules.Find(m => m.FilePath.Equals(File)); + var module = Modules.Find(m => m.FilePath.Equals(file)); if (module == null) { - module = new Module(File); + module = new Module(file); Modules.Add(module); } return module; } - public Enumeration FindEnum(string Name) + /// Finds an existing enum in the library modules. + public Enumeration FindEnum(string name) { foreach (var module in Modules) { - var type = module.Global.FindEnum(Name); + var type = module.FindEnum(name); if (type != null) return type; } return null; } - public Class FindClass(string Name) + /// Finds an existing struct/class in the library modules. + public Class FindClass(string name, bool create = false) { foreach (var module in Modules) { - var type = module.Global.FindClass(Name); + var type = module.FindClass(name, create); if (type != null) return type; } return null; } - - public string Name { get; set; } - public List Modules { get; set; } } } \ No newline at end of file