public CppClassResult AddClassResult(CppFileContextBase cppFileContext, PenWebClassSpecifier penWebClassSpecifier) { CppClassResult cppClassResult = null; if (!this.ClassMap.ContainsKey(penWebClassSpecifier.ClassName)) { cppClassResult = new CppClassResult(penWebClassSpecifier.ClassName, penWebClassSpecifier.BaseClass); this.ClassMap.Add(penWebClassSpecifier.ClassName, cppClassResult); return(cppClassResult); } else { return(this.ClassMap[penWebClassSpecifier.ClassName]); } }
public override void Init() { try { CppDeclarationSymbol symbol = this.Declaration.GetSymbol(); if (symbol != null) { this.VariableName = symbol.GetQualifiedName().GetNameStr(); } else { LogManager.Self.Log($"PenWebDeclaration() symbol is null"); } AttributeList attributeList = this.Declaration.AttributeListNode; if (attributeList != null) { foreach (ITreeNode attribute in attributeList.Children()) { var typeId = attribute.NodeType.ToString(); var toString = attribute.ToString(); } } base.Init(); HierarchySnapshot hierarchySnapshot = new HierarchySnapshot(this); PenWebDeclarator penWebDeclarator = this.GetChildByType <PenWebDeclarator>(); if (penWebDeclarator != null) { this.VariableName = penWebDeclarator.ItemName; } else { LogManager.Self.Log($"penWebDeclarator is null"); } if (String.IsNullOrWhiteSpace(this.VariableName)) { PenWebDeclaratorQualifiedName declaratorQualifiedName = this.GetChildByType <PenWebDeclaratorQualifiedName>(); if (declaratorQualifiedName != null) { this.VariableName = declaratorQualifiedName.ItemName; } else { LogManager.Self.Log($"declarationSpecifiers is null"); } } PenWebDeclarationSpecifiers declarationSpecifiers = this.GetChildByType <PenWebDeclarationSpecifiers>(); if (declarationSpecifiers != null) { this.TypeName = declarationSpecifiers.ItemName; } else { LogManager.Self.Log($"penWebDeclarator is null"); } PenWebClassSpecifier penWebClassSpecifier = this.GetParentByType <PenWebClassSpecifier>(); if (penWebClassSpecifier != null) { this.OwningClass = penWebClassSpecifier.ClassName; } this.CppFunctionCatagory = CppFunctionCatagory.VariableDef; if (!String.IsNullOrWhiteSpace(this.TypeName) && !String.IsNullOrWhiteSpace(this.VariableName) && !String.IsNullOrWhiteSpace(this.OwningClass)) { this.SaveToJson = true; } } catch (Exception e) { LogManager.Self.Log("PenWebDeclaration Exception", e); } this.Declaration = null; }