示例#1
0
        public ComField(IComBase parent, ITypeInfo info, string name, VARDESC varDesc, int index, DeclarationType type)
        {
            Parent = parent;
            Name   = name;
            Index  = index;
            Type   = type;

            Flags = (VARFLAGS)varDesc.wVarFlags;

            if (Type == DeclarationType.Constant)
            {
                var value = new ComVariant(varDesc.desc.lpvarValue);
                DefaultValue = value.Value;

                if (ComVariant.TypeNames.TryGetValue(value.VariantType, out string typeName))
                {
                    _valueType = typeName;
                }

                if (value.VariantType.HasFlag(VarEnum.VT_ARRAY))
                {
                    IsArray = true;
                }
            }
            else
            {
                GetFieldType(varDesc.elemdescVar.tdesc, info);
            }
        }
 public ComEnumeration(IComBase parent, ITypeLib typeLib, ITypeInfo info, TYPEATTR attrib, int index) : base(parent, typeLib, attrib, index)
 {
     Members = new List <ComEnumerationMember>();
     Type    = DeclarationType.Enumeration;
     GetEnumerationMembers(info, attrib);
     ComProject.KnownEnumerations.TryAdd(Guid, this);
 }
示例#3
0
 public ComInterface(IComBase parent, ITypeLib typeLib, ITypeInfo info, TYPEATTR attrib, int index) : base(parent, typeLib, attrib, index)
 {
     Type = DeclarationType.ClassModule;
     GetImplementedInterfaces(info, attrib);
     GetComProperties(info, attrib);
     GetComMembers(info, attrib);
 }
示例#4
0
 public ComCoClass(IComBase parent, ITypeLib typeLib, ITypeInfo info, TYPEATTR attrib, int index) : base(parent, typeLib, attrib, index)
 {
     Type = DeclarationType.ClassModule;
     GetImplementedInterfaces(info, attrib);
     IsControl = attrib.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FCONTROL);
     Debug.Assert(attrib.cFuncs == 0);
 }
示例#5
0
 protected ComBase(IComBase parent, ITypeInfo info)
 {
     Parent = parent;
     info.GetContainingTypeLib(out ITypeLib typeLib, out int index);
     Index = index;
     Debug.Assert(typeLib != null);
     Documentation = new ComDocumentation(typeLib, index);
 }
示例#6
0
 protected ComType(IComBase parent, ITypeInfo info, TYPEATTR attrib)
     : base(parent, info)
 {
     Guid          = attrib.guid;
     IsAppObject   = attrib.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FAPPOBJECT);
     IsPreDeclared = attrib.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FPREDECLID);
     IsHidden      = attrib.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FHIDDEN);
     IsRestricted  = attrib.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FRESTRICTED);
 }
示例#7
0
 protected ComType(IComBase parent, ITypeLib typeLib, TYPEATTR attrib, int index)
     : base(parent, typeLib, index)
 {
     Index         = index;
     Guid          = attrib.guid;
     IsAppObject   = attrib.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FAPPOBJECT);
     IsPreDeclared = attrib.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FPREDECLID);
     IsHidden      = attrib.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FHIDDEN);
     IsRestricted  = attrib.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FRESTRICTED);
 }
示例#8
0
        public ComMember(IComBase parent, ITypeInfo info, FUNCDESC funcDesc) : base(parent, info, funcDesc)
        {
            LoadParameters(funcDesc, info);
            var flags = (FUNCFLAGS)funcDesc.wFuncFlags;

            IsHidden                = flags.HasFlag(FUNCFLAGS.FUNCFLAG_FHIDDEN);
            IsRestricted            = flags.HasFlag(FUNCFLAGS.FUNCFLAG_FRESTRICTED);
            ReturnsWithEventsObject = flags.HasFlag(FUNCFLAGS.FUNCFLAG_FSOURCE);
            IsDefault               = Index == (int)DispId.Value;
            IsEnumerator            = Index == (int)DispId.NewEnum;
            IsEvaluateFunction      = Index == (int)DispId.Evaluate;
            SetDeclarationType(funcDesc, info);
        }
示例#9
0
 public ComModule(IComBase parent, ITypeLib typeLib, ITypeInfo info, TYPEATTR attrib, int index) : base(parent, typeLib, attrib, index)
 {
     Debug.Assert(attrib.cFuncs >= 0 && attrib.cVars >= 0);
     Type = DeclarationType.ProceduralModule;
     if (attrib.cFuncs > 0)
     {
         GetComMembers(info, attrib);
     }
     if (attrib.cVars > 0)
     {
         GetComFields(info, attrib);
     }
 }
示例#10
0
        public ComAlias(IComBase parent, ITypeLib typeLib, ITypeInfo info, int index, TYPEATTR attributes) : base(parent, typeLib, index)
        {
            Index         = index;
            Documentation = new ComDocumentation(typeLib, index);
            Guid          = attributes.guid;
            IsHidden      = attributes.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FHIDDEN);
            IsRestricted  = attributes.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FRESTRICTED);

            if (Name.Equals("LONG_PTR"))
            {
                TypeName = Tokens.LongPtr;
                return;
            }

            var aliased = new ComParameter(attributes, info);

            TypeName = aliased.TypeName;
        }
示例#11
0
        public ComInterface(IComBase parent, ITypeInfo info, TYPEATTR attrib) : base(parent, info, attrib)
        {
            // Since the reference declaration gathering is threaded, this can't be truly recursive, so implemented interfaces may have
            // null parents (for example, if the library references a type library that isn't referenced by the VBA project or if that project
            // hasn't had the implemented interface processed yet).
            try
            {
                info.GetContainingTypeLib(out var typeLib, out _);
                typeLib.GetLibAttr(out IntPtr attribPtr);
                using (DisposalActionContainer.Create(attribPtr, typeLib.ReleaseTLibAttr))
                {
                    var typeAttr = Marshal.PtrToStructure <TYPELIBATTR>(attribPtr);
                    Parent = typeAttr.guid.Equals(parent?.Project.Guid) ? parent?.Project : null;
                }
            }
            catch
            {
                Parent = null;
            }

            GetImplementedInterfaces(info, attrib);
            GetComProperties(info, attrib);
            GetComMembers(info, attrib);
        }
示例#12
0
 public ComStruct(IComBase parent, ITypeLib typeLib, ITypeInfo info, TYPEATTR attrib, int index)
     : base(parent, typeLib, attrib, index)
 {
     Type = DeclarationType.UserDefinedType;
     GetFields(info, attrib);
 }
示例#13
0
 protected ComBase(IComBase parent, ITypeInfo info, FUNCDESC funcDesc)
 {
     Parent        = parent;
     Index         = funcDesc.memid;
     Documentation = new ComDocumentation(info, funcDesc.memid);
 }
示例#14
0
 protected ComBase(IComBase parent, ITypeLib typeLib, int index)
 {
     Parent        = parent;
     Index         = index;
     Documentation = new ComDocumentation(typeLib, index);
 }