コード例 #1
0
ファイル: CppLibrary.cs プロジェクト: zhoulihe1981/cxxi
        // For working with a class that you are not instantiating
        //  from managed code and where access to fields is not necessary
        public Iface GetClass <Iface> (string className)
            where Iface : ICppClass
        {
            var typeInfo = Abi.MakeTypeInfo(this, className, typeof(Iface), null, null);

            return((Iface)Abi.ImplementClass(typeInfo));
        }
コード例 #2
0
ファイル: CppLibrary.cs プロジェクト: zhoulihe1981/cxxi
        // For instantiating or working with a class that may have fields
        //  but where overriding virtual methods in managed code is not necessary
        public Iface GetClass <Iface, NativeLayout> (string className)
            where Iface : ICppClassInstantiatable
            where NativeLayout : struct
        {
            var typeInfo = Abi.MakeTypeInfo(this, className, typeof(Iface), typeof(NativeLayout), null);

            return((Iface)Abi.ImplementClass(typeInfo));
        }
コード例 #3
0
ファイル: CppLibrary.cs プロジェクト: zhoulihe1981/cxxi
        /* The most powerful override. Allows the following from managed code:
         *      + Instantiation
         *      + Field access
         *      + Virtual method overriding
         */
        public Iface GetClass <Iface, NativeLayout, Managed> (string className)
            where Iface : ICppClassOverridable <Managed>
            where NativeLayout : struct
            where Managed : ICppObject
        {
            var typeInfo = Abi.MakeTypeInfo(this, className, typeof(Iface), typeof(NativeLayout), typeof(Managed));

            return((Iface)Abi.ImplementClass(typeInfo));
        }