AsObjectThis() public méthode

public AsObjectThis ( ) : Dispatch2
Résultat Dispatch2
Exemple #1
0
 //private Callback mCallback;
 //private VariantClosure mCallbackClosure;
 // a class to receive member callback from class
 // destination object
 /// <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)
 {
     // *param[0] = name   *param[1] = flags   *param[2] = value
     int flags = param[1].AsInteger();
     if ((flags & Interface.STATICMEMBER) == 0)
     {
         Variant val = new Variant(param[2]);
         if (val.IsObject())
         {
             // change object's objthis if the object's objthis is null
             if (val.AsObjectThis() == null)
             {
                 val.ChangeClosureObjThis(mDest);
             }
         }
         mDest.PropSet(Interface.MEMBERENSURE | Interface.IGNOREPROP | flags, param[0].AsString
             (), val, mDest);
     }
     if (result != null)
     {
         result.Set(1);
     }
     // returns true
     return Error.S_OK;
 }
Exemple #2
0
 /// <summary>new する时のメンバコピー</summary>
 /// <param name="dest">コピー先</param>
 /// <returns>エラーコード</returns>
 /// <exception cref="TJSException">TJSException</exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 protected internal virtual int CopyAllMembers(Kirikiri.Tjs2.CustomObject dest)
 {
     if (!GetValidity())
     {
         return Error.E_INVALIDOBJECT;
     }
     if (!dest.GetValidity())
     {
         return Error.E_INVALIDOBJECT;
     }
     Variant result = new Variant();
     for (int i = 0; i < mHashSize; i++)
     {
         SymbolData lv1 = mSymbols[i];
         SymbolData d = lv1.mNext;
         while (d != null)
         {
             SymbolData nextd = d.mNext;
             if (((d.mSymFlags & SYMBOL_USING) != 0) && ((d.mSymFlags & SYMBOL_STATIC) == 0))
             {
                 if (d.mValue.IsObject())
                 {
                     result.Set(d.mValue);
                     if (result.AsObjectThis() == null)
                     {
                         result.ChangeClosureObjThis(dest);
                     }
                     SymbolData data = dest.Add(d.mName);
                     if ((d.mSymFlags & SYMBOL_HIDDEN) != 0)
                     {
                         data.mSymFlags |= SYMBOL_HIDDEN;
                     }
                     else
                     {
                         data.mSymFlags &= ~SYMBOL_HIDDEN;
                     }
                     data.mValue.CopyRef(result);
                 }
             }
             d = nextd;
         }
         if (((lv1.mSymFlags & SYMBOL_USING) != 0) && ((lv1.mSymFlags & SYMBOL_STATIC) ==
             0))
         {
             if (lv1.mValue.IsObject())
             {
                 result.Set(lv1.mValue);
                 if (result.AsObjectThis() == null)
                 {
                     result.ChangeClosureObjThis(dest);
                 }
                 SymbolData data = dest.Add(lv1.mName);
                 if ((lv1.mSymFlags & SYMBOL_HIDDEN) != 0)
                 {
                     data.mSymFlags |= SYMBOL_HIDDEN;
                 }
                 else
                 {
                     data.mSymFlags &= ~SYMBOL_HIDDEN;
                 }
                 data.mValue.CopyRef(result);
             }
         }
     }
     return Error.S_OK;
 }