/// <summary> /// Reads the module from the specified input. /// </summary> /// <param name="input">The input.</param> /// <returns>A C++ module</returns> public static CppModule Read(Stream input) { var ds = new XmlSerializer(typeof(CppModule)); CppModule module = null; using (XmlReader w = XmlReader.Create(input)) { module = ds.Deserialize(w) as CppModule; } if (module != null) { module.ResetParents(); } return(module); }
/// <summary> /// Parses the specified C++ header file and fills the <see cref="CppModule"/> with defined macros. /// </summary> /// <param name="file">The C++ header file to parse.</param> /// <param name="group">The CppIncludse object to fill with macro definitions.</param> public void Parse(string file, CppModule group) { _gccxml.Preprocess(file, ParseLine); foreach (var includeName in _mapIncludeToMacros.Keys) { var includeId = Path.GetFileNameWithoutExtension(includeName).ToLower(); var include = group.FindInclude(includeId); if (include == null) { include = new CppInclude() { Name = includeId }; group.Add(include); } foreach (var macroDefinition in _mapIncludeToMacros[includeName]) include.Add(new CppDefine(macroDefinition.Key, macroDefinition.Value)); } }