static DocRootNamespace Categorize(Dictionary <GacUDT, DocTypeInfo> typeGroupedItems, Tuple <XElement, GacMethod>[] gfuncItems, Dictionary <string, GacUDT> udts) { HashSet <GacUDT> hashUdts = new HashSet <GacUDT>(typeGroupedItems.Keys); DocRootNamespace root = new DocRootNamespace(); foreach (var p in typeGroupedItems) { DocType type = root.GetType(p.Key, udts); FillType(type, p, root, udts, hashUdts); } foreach (var m in gfuncItems) { CppName[] names = CppName.Parse(m.Item2.Name).Cascade().ToArray(); string[] nsNames = names.Take(names.Length - 1).Select(n => n.Name).ToArray(); var ns = root.GetNamespace(nsNames); BuildFunction(ns, m); } return(root); }
static void FillType(DocType type, KeyValuePair <GacUDT, DocTypeInfo> info, DocRootNamespace root, Dictionary <string, GacUDT> udts, HashSet <GacUDT> hashUdts) { type.UdtDocItem = info.Value.TypeDocItem; type.BaseTypes = info.Key .BaseClasses .Where(b => b.Access != GacAccess.Private) .Where(b => hashUdts.Contains(b.UDT)) .Select(b => new DocBaseType { Type = root.GetType(b.UDT, udts), BaseClass = b, }) .ToArray(); foreach (var m in info.Value.Fields) { BuildField(type, m); } foreach (var m in info.Value.Methods) { BuildFunction(type, m); } }