コード例 #1
0
    public ComponentAttributeValues(AttributedType attributedType)
    {
        if (attributedType.Attribute.Properties.ContainsKey("InvokeOnObjectCreationEvent"))
        {
            this.InvokeOnObjectCreationEvent = (bool)attributedType.Attribute.Properties["InvokeOnObjectCreationEvent"].Value;
        }
        foreach (var item in attributedType.Attribute.ConstructorArguments)
        {
            switch (item.Type.FullName)
            {
            case "System.String":
                this.ContractName = item.Value as string;
                break;

            case "System.Type":
                this.ContractType = (item.Value as TypeReference)?.ToBuilderType() ?? item.Value as BuilderType ?? Builder.Current.Import(item.Value as Type)?.ToBuilderType();
                break;

            case "System.UInt32":
                this.Priority = (uint)item.Value;
                break;

            case "Cauldron.Activator.FactoryCreationPolicy":
                this.Policy = (int)item.Value;
                break;
            }
        }
    }
コード例 #2
0
        public static FactoryTypeInfoWeaverBase Create(AttributedType component)
        {
            var result = Create(component.Type, new ComponentAttributeValues(component));

            component.Attribute.Remove();
            return(result);
        }
コード例 #3
0
ファイル: ASTConverter.cs プロジェクト: gpetrou/CppSharp
        public override AST.Type VisitAttributed(AttributedType type)
        {
            var _type = new CppSharp.AST.AttributedType();

            VisitType(type, _type);
            _type.Modified   = VisitQualified(type.Modified);
            _type.Equivalent = VisitQualified(type.Equivalent);
            return(_type);
        }
コード例 #4
0
ファイル: ASTVisitor.cs プロジェクト: sunyuan213/CppSharp
        public bool VisitAttributedType(AttributedType attributed, TypeQualifiers quals)
        {
            if (!VisitType(attributed, quals))
            {
                return(false);
            }

            return(attributed.Modified.Visit(this));
        }
        public void ObjectGetAttribute_ReflectedInfo_AsExpected()
        {
            // ----------------------- Arrange -----------------------
            var instance = new AttributedType();

            // -----------------------   Act   -----------------------
            // -----------------------  Assert -----------------------
            Assert.NotNull(instance.GetAttribute <IsTestedAttribute>());
            Assert.Null(this.GetAttribute <IsTestedAttribute>());
        }
        public void ObjectHasAttribute_ReflectedInfo_AsExpected()
        {
            // ----------------------- Arrange -----------------------
            var instance = new AttributedType();

            // -----------------------   Act   -----------------------
            // -----------------------  Assert -----------------------
            Assert.True(instance.HasAttribute <IsTestedAttribute>());
            Assert.False(this.HasAttribute <IsTestedAttribute>());
        }
コード例 #7
0
        public void op_JsonSerialize_object_whenAttributedType(string expected)
        {
            var example = new AttributedType
            {
                Ignore = "ignore",
                Value  = "value"
            };

            var actual = example.JsonSerialize();

            Assert.Equal(expected, actual);
        }
コード例 #8
0
ファイル: AST.cs プロジェクト: RainsSoft/CppSharp
 protected AttributedType(AttributedType.Internal* native, bool isInternalImpl = false)
     : base((CppSharp.Parser.AST.Type.Internal*) native)
 {
 }
コード例 #9
0
ファイル: AST.cs プロジェクト: RainsSoft/CppSharp
 private static AttributedType.Internal* __CopyValue(AttributedType.Internal native)
 {
     var ret = Marshal.AllocHGlobal(40);
     CppSharp.Parser.AST.AttributedType.Internal.cctor_2(ret, new global::System.IntPtr(&native));
     return (AttributedType.Internal*) ret;
 }
コード例 #10
0
 public bool VisitAttributedType(AttributedType attributed, TypeQualifiers quals)
 {
     throw new NotImplementedException();
 }
コード例 #11
0
 public BooleanExpressionCallCoder NewObj(AttributedType attributedType)
 {
     this.NewObj(attributedType.customAttribute);
     return(new BooleanExpressionCallCoder(this, attributedType.Attribute.Type));
 }
コード例 #12
0
ファイル: AST.cs プロジェクト: CSRedRat/CppSharp
 private AttributedType(AttributedType.Internal native, bool skipVTables = false)
     : this(__CopyValue(native), skipVTables)
 {
     __ownsNativeInstance = true;
     NativeToManagedMap[__Instance] = this;
 }
コード例 #13
0
ファイル: AST.cs プロジェクト: KonajuGames/CppSharp
 private AttributedType(AttributedType.Internal native)
     : this(__CopyValue(native))
 {
     __ownsNativeInstance = true;
 }
コード例 #14
0
ファイル: AST.cs プロジェクト: vovkasm/CppSharp
 internal AttributedType(AttributedType.Internal native)
     : this(__CopyValue(native))
 {
 }
コード例 #15
0
 public bool VisitAttributedType(AttributedType attributed, TypeQualifiers quals)
 {
     return(false);
 }
コード例 #16
0
ファイル: TypePrinter.cs プロジェクト: Oceanswave/CppSharp
 public virtual TypePrinterResult VisitAttributedType(AttributedType attributed,
                                                      TypeQualifiers quals)
 {
     throw new NotImplementedException();
 }
コード例 #17
0
 public void TestMethod7() => // Noncompliant, attribute must be on the method itself
 AttributedType.AttributeOnType();
コード例 #18
0
 private static void* __CopyValue(AttributedType.__Internal native)
 {
     var ret = Marshal.AllocHGlobal(24);
     global::CppSharp.Parser.AST.AttributedType.__Internal.cctor_2(ret, new global::System.IntPtr(&native));
     return ret.ToPointer();
 }
コード例 #19
0
ファイル: AST.cs プロジェクト: CSRedRat/CppSharp
 public static AttributedType __CreateInstance(AttributedType.Internal native, bool skipVTables = false)
 {
     return new AttributedType(native, skipVTables);
 }
コード例 #20
0
ファイル: AST.cs プロジェクト: kidleon/CppSharp
 internal AttributedType(AttributedType.Internal* native)
     : this(new global::System.IntPtr(native))
 {
 }
コード例 #21
0
ファイル: AST.cs プロジェクト: CSRedRat/CppSharp
 protected AttributedType(AttributedType.Internal* native, bool skipVTables = false)
     : base((CppSharp.Parser.AST.Type.Internal*) null)
 {
     __PointerAdjustment = 0;
     if (native == null)
         return;
     __Instance = new global::System.IntPtr(native);
 }
コード例 #22
0
ファイル: AST.cs プロジェクト: kidleon/CppSharp
 internal AttributedType(AttributedType.Internal native)
     : this(&native)
 {
 }
コード例 #23
0
 public CSharpTypePrinterResult VisitAttributedType(AttributedType attributed,
                                                    TypeQualifiers quals)
 {
     return(attributed.Modified.Visit(this));
 }
コード例 #24
0
ファイル: ASTConverter.cs プロジェクト: gpetrou/CppSharp
 public abstract TRet VisitAttributed(AttributedType type);
コード例 #25
0
ファイル: AST.cs プロジェクト: RainsSoft/CppSharp
 public static AttributedType __CreateInstance(AttributedType.Internal native)
 {
     return new AttributedType(native);
 }
コード例 #26
0
ファイル: ASTConverter.cs プロジェクト: gpetrou/CppSharp
        public TRet Visit(Parser.AST.Type type)
        {
            if (type.__Instance == IntPtr.Zero)
            {
                return(default(TRet));
            }

            switch (type.Kind)
            {
            case TypeKind.Tag:
            {
                var _type = new TagType(type.__Instance);
                return(VisitTag(_type));
            }

            case TypeKind.Array:
            {
                var _type = new ArrayType(type.__Instance);
                return(VisitArray(_type));
            }

            case TypeKind.Function:
            {
                var _type = new FunctionType(type.__Instance);
                return(VisitFunction(_type));
            }

            case TypeKind.Pointer:
            {
                var _type = new PointerType(type.__Instance);
                return(VisitPointer(_type));
            }

            case TypeKind.MemberPointer:
            {
                var _type = new MemberPointerType(type.__Instance);
                return(VisitMemberPointer(_type));
            }

            case TypeKind.Typedef:
            {
                var _type = new TypedefType(type.__Instance);
                return(VisitTypedef(_type));
            }

            case TypeKind.Attributed:
            {
                var _type = new AttributedType(type.__Instance);
                return(VisitAttributed(_type));
            }

            case TypeKind.Decayed:
            {
                var _type = new DecayedType(type.__Instance);
                return(VisitDecayed(_type));
            }

            case TypeKind.TemplateSpecialization:
            {
                var _type = new TemplateSpecializationType(type.__Instance);
                return(VisitTemplateSpecialization(_type));
            }

            case TypeKind.TemplateParameter:
            {
                var _type = new TemplateParameterType(type.__Instance);
                return(VisitTemplateParameter(_type));
            }

            case TypeKind.TemplateParameterSubstitution:
            {
                var _type = new TemplateParameterSubstitutionType(type.__Instance);
                return(VisitTemplateParameterSubstitution(_type));
            }

            case TypeKind.InjectedClassName:
            {
                var _type = new InjectedClassNameType(type.__Instance);
                return(VisitInjectedClassName(_type));
            }

            case TypeKind.DependentName:
            {
                var _type = new DependentNameType(type.__Instance);
                return(VisitDependentName(_type));
            }

            case TypeKind.Builtin:
            {
                var _type = new BuiltinType(type.__Instance);
                return(VisitBuiltin(_type));
            }
            }

            throw new ArgumentOutOfRangeException();
        }
コード例 #27
0
ファイル: AST.cs プロジェクト: RainsSoft/CppSharp
 private AttributedType(AttributedType.Internal native)
     : this(__CopyValue(native))
 {
     __ownsNativeInstance = true;
     NativeToManagedMap[__Instance] = this;
 }
コード例 #28
0
 private static string GetTypeName(AttributedType type)
 {
     return(GetTypeName(PrimitiveType.Void));
 }
コード例 #29
0
 public string VisitAttributedType(AttributedType attributed, TypeQualifiers quals)
 {
     return(attributed.Modified.Visit(this));
 }
コード例 #30
0
 public string VisitAttributedType(AttributedType attributed, TypeQualifiers quals)
 {
     throw new NotSupportedException( );
 }