Exemple #1
0
        public override void Init()
        {
            try
            {
                Declaration declarationNode = this.SimpleDeclaration.DeclarationNode;

                if (declarationNode != null)
                {
                    CppDeclarationSymbol symbol = declarationNode.GetSymbol();

                    if (symbol != null)
                    {
                        ICppParserSymbol parentSymbol = symbol.Parent;

                        CppQualifiedName parentQualfiedName = parentSymbol.GetQualifiedName();
                        string           parentQualName     = parentQualfiedName.GetNameStr();

                        string parentShortName = parentSymbol.GetShortName();

                        ICppParserSymbol classByMemberSymbol = parentSymbol.GetClassByMember();

                        string classByMemberShortName = classByMemberSymbol.GetShortName();

                        ICppParserSymbol enclosingClassSymbol = parentSymbol.GetEnclosingClass(true);
                        CppQualifiedName qualifiedInnerName   = parentSymbol.GetQualifiedInnerName();

                        CppQualType cppQualType = symbol.GetDeclSpecType();
                        string      debugStr    = cppQualType.DbgDescription;

                        CppTypeVisitor cppTypeVisitor = new CppTypeVisitor();


                        if (cppQualType.RefFlag != ReferenceFlag.Empty)
                        {
                            cppQualType.Accept(cppTypeVisitor);

                            string typeStr = cppTypeVisitor.TypeStr;
                            string dbgStr  = cppTypeVisitor.DbgStr;

                            this.ItemName = cppTypeVisitor.Name;

                            switch (cppTypeVisitor.CppType)
                            {
                            case CppTypeVisitorType.Class:
                                this.PenWebDeclarationType = PenWebDeclarationType.ClassDef;
                                break;

                            case CppTypeVisitorType.Enum:
                                this.PenWebDeclarationType = PenWebDeclarationType.EnumDef;
                                break;

                            default:
                                break;
                            }
                        }

                        /*
                         * CppQualifiedName cppQualifiedName = symbol.GetQualifiedName();
                         *
                         * ICppQualifiedNamePart namePart = cppQualifiedName.Name;
                         *
                         * string partStr = namePart.ToString();
                         *
                         * var subQualifier = cppQualifiedName.Qualifier;
                         *
                         * string qualiferStr = subQualifier.GetNameStr();
                         */


                        if (!String.IsNullOrWhiteSpace(this.ItemName))
                        {
                            Console.WriteLine("");
                        }
                    }
                    else
                    {
                        LogManager.Self.Log($"PenWebSimpleDeclaration() declarationNode.symbol is null");
                    }

                    ICppResolvedTypeFactory cppResolvedTypeFactory = declarationNode.GetTypeFactory();

                    if (cppResolvedTypeFactory != null)
                    {
                        cppResolvedTypeFactory.GetIdentityTypeVisitor();
                    }
                }
                else
                {
                    LogManager.Self.Log($"PenWebSimpleDeclaration() declarationNode is null");
                }


                /*
                 * CompoundStatement compoundStatement = this.SimpleDeclaration.CompoundStatementNode;
                 *
                 * if (compoundStatement != null)
                 * {
                 *
                 * }
                 *
                 * CtorInitializer ctorInitializer = this.SimpleDeclaration.ConstructorInitializerNode;
                 *
                 * if (ctorInitializer != null)
                 * {
                 *
                 * }
                 *
                 * DefaultSpecifier defaultSpecifier  = this.SimpleDeclaration.DefaultSpecifierNode;
                 *
                 * if (defaultSpecifier != null)
                 * {
                 *
                 * }
                 *
                 * CtorBlock constructorBlock = this.SimpleDeclaration.ConstructorBlock;
                 *
                 * ITreeNode simicolonNode = this.SimpleDeclaration.SemicolonNode;
                 *
                 * ITreeNode trailingNode = this.SimpleDeclaration.TrailingNode;
                 */


                base.Init();

                //this.SaveToJson = true;
            }
            catch (Exception e)
            {
                LogManager.Self.Log("PenWebSimpleDeclaration Exception", e);
            }

            this.SimpleDeclaration = null;
        }