Exemplo n.º 1
0
        /// <exception cref="VariantException"></exception>
        /// <exception cref="TjsException"></exception>
        public override int CreateNew(int flag, string membername, Holder <Dispatch2> result
                                      , Variant[] param, Dispatch2 objthis)
        {
            // CreateNew
            Dispatch2 dsp = CreateBaseTJSObject();

            // instance initialization
            //int hr = funcCall( 0, null, null, null, dsp); // add member to dsp
            // 生成を高速化するためにメンバコピーを特别处理する形で实装
            dsp.AddClassInstanveInfo(ClassName);
            NativeInstance nativeptr = CreateNativeInstance();

            dsp.SetNativeInstance(ClassId, nativeptr);
            int hr = CopyAllMembers((CustomObject)dsp);

            if (hr < 0)
            {
                return(hr);
            }
            hr = base.FuncCall(0, ClassName, null, param, dsp);
            // call constructor
            // call the constructor
            if (hr == Error.E_MEMBERNOTFOUND)
            {
                hr = Error.S_OK;
            }
            // missing constructor is OK ( is this ugly ? )
            if (hr >= 0)
            {
                result.Set(dsp);
            }
            return(hr);
        }
Exemplo n.º 2
0
        /// <exception cref="VariantException"></exception>
        /// <exception cref="TjsException"></exception>
        public override int FuncCall(int flag, string membername, Variant result, Variant
                                     [] param, Dispatch2 objthis)
        {
            if (!GetValidity())
            {
                return(Error.E_INVALIDOBJECT);
            }
            if (membername != null)
            {
                return(base.FuncCall(flag, membername, result, param, objthis));
            }
            // 生成を高速化するためにメンバコピーを特别处理する形で实装
            objthis.AddClassInstanveInfo(ClassName);
            NativeInstance nativeptr = CreateNativeInstance();

            objthis.SetNativeInstance(ClassId, nativeptr);
            int hr = CopyAllMembers((CustomObject)objthis);

            if (hr < 0)
            {
                return(hr);
            }
            return(Error.S_OK);
        }
Exemplo n.º 3
0
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public override int FuncCall(int flag, string membername, Variant result, Variant
     [] param, Dispatch2 objthis)
 {
     if (!GetValidity())
     {
         return Error.E_INVALIDOBJECT;
     }
     if (membername != null)
     {
         return base.FuncCall(flag, membername, result, param, objthis);
     }
     // 生成を高速化するためにメンバコピーを特别处理する形で实装
     objthis.AddClassInstanveInfo(mClassName);
     NativeInstance nativeptr = CreateNativeInstance();
     objthis.SetNativeInstance(mClassIDInternal, nativeptr);
     int hr = CopyAllMembers((CustomObject)objthis);
     if (hr < 0)
     {
         return hr;
     }
     return Error.S_OK;
 }