Esempio n. 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="cursor">Clang Cursor</param>
        public InvokationInfo(ClangCursor cursor) : base(cursor)
        {
            this.Name = cursor.Spelling;

            if (cursor.Referenced != null)
            {
                this.Declaration = BehaviorInfoFactory.Create(cursor.Referenced);

                this.ID = this.Declaration.ID;

                this.Definition = this.Declaration.Definition;
            }
            else
            {
                throw new FieldAccessException($"Behavior Declaration Not Found : {this.Name}");
            }
        }
            /// <summary>
            /// Analyse Invokation Info
            /// </summary>
            /// <param name="cursor">Clang Cursor</param>
            private void AnalyseInvokationInfo(ClangCursor cursor)
            {
                switch (cursor.Kind)
                {
                case CursorKind.TranslationUnit:
                    this.CurrentTranslationUnit = new TranslationUnitInfo(cursor);
                    this.TranslationUnitMap.Add(this.CurrentTranslationUnit);
                    break;

                case CursorKind.Constructor:
                    this.CurrentBehavior = BehaviorInfoFactory.Create(cursor);
                    this.CurrentTranslationUnit.AddBehavior(this.CurrentBehavior);
                    break;

                case CursorKind.Destructor:
                    this.CurrentBehavior = BehaviorInfoFactory.Create(cursor);
                    this.CurrentTranslationUnit.AddBehavior(this.CurrentBehavior);
                    break;

                case CursorKind.FunctionDeclaration:
                    this.CurrentBehavior = BehaviorInfoFactory.Create(cursor);
                    this.CurrentTranslationUnit.AddBehavior(this.CurrentBehavior);
                    break;

                case CursorKind.CXXMethod:
                    this.CurrentBehavior = BehaviorInfoFactory.Create(cursor);
                    this.CurrentTranslationUnit.AddBehavior(this.CurrentBehavior);
                    break;

                case CursorKind.CallExpression:
                    var invokation_info = new InvokationInfo(cursor);
                    this.CurrentBehavior.AddInvokation(invokation_info);
                    break;

                default:
                    break;
                }
            }