Beispiel #1
0
        public override void Init()
        {
            try
            {
                QualifiedReference qualifiedReference = this.MemberAccessExpression.Member;

                if (qualifiedReference != null)
                {
                    CppQualifiedName cppQualifiedName = qualifiedReference.GetQualifiedName();

                    this.MethodName = cppQualifiedName.GetNameStr();
                }

                ICppExpressionNode cppExpressionNode  = this.MemberAccessExpression.Qualifier;
                CppTypeAndCategory cppTypeAndCatagory = cppExpressionNode.GetTypeAndCategory();
                CppQualType        cppQualType        = cppTypeAndCatagory.Type;

                CppTypeVisitor cppTypeVisitor = new CppTypeVisitor();

                cppQualType.Accept(cppTypeVisitor);

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

                this.Class = cppTypeVisitor.Name;

                if (String.IsNullOrWhiteSpace(this.Class))
                {
                    this.Class = dbgStr;

                    LogManager.Self.Log($"PenWebMemberAccessExpression() class name empty");

                    cppQualType.Accept(cppTypeVisitor);

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

                    this.Class = cppTypeVisitor.Name;
                }

                /*
                 * ICppExpression leftArguement = this.MemberAccessExpression.GetLeftArgument();
                 * CppExpressionVisitor cppExpressionVisitor = new CppExpressionVisitor();
                 * leftArguement.Accept<CppExpressonVisitorResult>(cppExpressionVisitor);
                 */

                base.Init();

                this.CppFunctionCatagory = CppFunctionCatagory.MethodCall;

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

            this.MemberAccessExpression = null;
            this.CppExpressionNode      = null;
        }
        public override void Init()
        {
            try
            {
                CppQualifiedName cppQualifiedName = this.DeclarationSpecifierTypename.GetQualifiedName();

                this.TypeName = cppQualifiedName.GetNameStr();

                CppClassTag cppClassTag = this.DeclarationSpecifierTypename.GetClassTag();

                this.ClassTag = cppClassTag.ToString("g");

                DeclarationSpecifiersBase declarationSpecifiers = this.DeclarationSpecifierTypename.GetDeclarationSpecifiers();

                switch (declarationSpecifiers)
                {
                case BaseTypeGenericConstraintItem genericConstraintItem:
                    break;

                case DeclarationSpecifiers specifiers:
                    break;

                case EnumBase enumBase:
                    break;

                default:
                    break;
                }

                string identifier = this.DeclarationSpecifierTypename.Identifier.GetText();

                TypeId typeId = this.DeclarationSpecifierTypename.CliSimpleTypeId;

                if (typeId != null)
                {
                    string typeIdStr = typeId.GetText();

                    CppQualType cppQualType = typeId.GetQualType();

                    CppTypeVisitor cppTypeVisitor = new CppTypeVisitor();

                    cppQualType.Accept(cppTypeVisitor);

                    string typeStr = cppTypeVisitor.TypeStr;
                    string nameStr = cppTypeVisitor.Name;
                    string dbgStr  = cppTypeVisitor.DbgStr;
                }

                base.Init();

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

            this.DeclarationSpecifierTypename = null;
        }
        public override void Init()
        {
            try
            {
                this.ClassName = this.ClassSpecifier.DeclaredName;

                this.AstState    = AstState.InClass;
                this.CurrentType = this.ClassName;

                BaseClause baseClause = this.ClassSpecifier.GetBaseClause();

                if (baseClause != null)
                {
                    foreach (BaseSpecifier baseNode in baseClause.BaseSpecifierNodes)
                    {
                        QualifiedBaseTypeReference baseReference = baseNode.QualifiedBaseTypeReferenceNode;

                        if (baseReference != null)
                        {
                            CppQualifiedName qualifiedName = baseReference.GetQualifiedName();

                            this.BaseClass = qualifiedName.GetNameStr();
                        }
                        else
                        {
                            LogManager.Self.Log("PenWebClassSpecifier() baseReference is null");
                        }
                    }
                }
                else
                {
                    LogManager.Self.Log("PenWebClassSpecifier() baseClause is null");
                }

                base.Init();

                this.CppFunctionCatagory = CppFunctionCatagory.ClassDef;

                if (!String.IsNullOrWhiteSpace(this.ClassName) && !String.IsNullOrWhiteSpace(this.BaseClass))
                {
                    this.SaveToJson = true;
                }

                IDeclaredElement declarationElement = this.ClassSpecifier.DeclaredElement;

                foreach (IDeclaration declaration in declarationElement.GetDeclarations())
                {
                }
            }
            catch (Exception e)
            {
                LogManager.Self.Log("PenWebClassSpecifier Exception", e);
            }

            this.ClassSpecifier = null;
        }
        public override void Init()
        {
            try
            {
                //QualifiedReference qualifiedReference = this.QualifiedReference;

                CppQualifiedName cppQualifiedName = this.QualifiedReference.GetQualifiedName();

                this.ItemName = cppQualifiedName.GetNameStr();


                CppResolveResult cppResolveResult = this.QualifiedReference.GetResolvedReference();

                switch (cppResolveResult.GetStatus())
                {
                case CppResolveResult.Status.OK:
                    ICppResolveEntity cppResolveEntity = cppResolveResult.GetPrimaryEntity();
                    if (cppResolveEntity != null)
                    {
                        /*
                         * IGenericSymbolNode genericSymbolNode = cppResolveEntity.TryGetDeclarator();
                         *
                         * if (genericSymbolNode != null)
                         * {
                         *  ICppSymbol cppSymbol = genericSymbolNode.GetGenericSymbol();
                         *
                         *  string symbolType = cppSymbol.GetType().Name;
                         *
                         *  switch (cppSymbol)
                         *  {
                         *      case CppDeclaratorSymbol cppDeclaratorSymbol:
                         *          break;
                         *
                         *      default:
                         *          break;
                         *  }
                         * }
                         */

                        ICppQualifiedNamePart cppQualifiedNamePart = cppResolveEntity.Name;

                        ICppResolveEntity parentResolveEntity = cppResolveEntity.StructuralParent;

                        if (parentResolveEntity != null && parentResolveEntity.Name != null)
                        {
                            this.OwningClass = parentResolveEntity.Name.GetNameStr();
                        }

                        //string namePartStr = cppQualifiedNamePart.GetNameStr();
                    }
                    break;

                default:
                    break;
                }

                //ICppQualifiedNamePart cppQualifiedNamePart = this.QualifiedReference.NamePart;
                //ICppExpressionNode cppExpressionNode = this.MemberAccessExpression.Qualifier;
                CppTypeAndCategory cppTypeAndCatagory = this.QualifiedReference.GetTypeAndCategory();

                CppQualType cppQualType = cppTypeAndCatagory.Type;

                CppTypeVisitor cppTypeVisitor = new CppTypeVisitor();

                cppQualType.Accept(cppTypeVisitor);

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

                this.TypeName = cppTypeVisitor.DbgStr;

                /*
                 * ICppExpression leftArguement = this.MemberAccessExpression.GetLeftArgument();
                 * CppExpressionVisitor cppExpressionVisitor = new CppExpressionVisitor();
                 * leftArguement.Accept<CppExpressonVisitorResult>(cppExpressionVisitor);
                 */

                base.Init();

                this.CppFunctionCatagory = CppFunctionCatagory.VariableRef;

                /*
                 * PenWebDeclaration penWebDeclaration = this.GetParentByType<PenWebDeclaration>();
                 *
                 * if (penWebDeclaration != null)
                 * {
                 *  string owningClass = penWebDeclaration.OwningClass;
                 *  string typeName = penWebDeclaration.TypeName;
                 *  string itemName = penWebDeclaration.VariableName;
                 *
                 * }
                 */

                if (!String.IsNullOrWhiteSpace(this.ItemName) && !String.IsNullOrWhiteSpace(this.TypeName) && !String.IsNullOrWhiteSpace(this.OwningClass))
                {
                    this.SaveToJson = true;
                }
            }
            catch (Exception e)
            {
                LogManager.Self.Log("PenWebQualifiedReference Exception", e);
            }

            this.QualifiedReference = null;
        }
Beispiel #5
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;
        }