/// <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); }
public override int GetHashCode() { unchecked { return((NativeInstance.GetHashCode() * 397) ^ DisposedCounter); } }
public override int GetHashCode() { int hashCode = -16276663; hashCode = hashCode * -1521134295 + NativeInstance.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <PropT> .Default.GetHashCode(props); hashCode = hashCode * -1521134295 + EqualityComparer <Action <Godot.Node, PropT> > .Default.GetHashCode(callback); return(hashCode); }
public bool Equals(NativeObject other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(NativeInstance.Equals(other.NativeInstance) && IsDisposed == other.IsDisposed); }
/// <summary> /// Converts a JavaScript object or value to a JSON string, optionally replacing values if /// a <paramref name="replacer"/> function is specified or optionally including only /// the specified properties if a <paramref name="replacer"/> array is specified. /// </summary> /// <param name="replacer"> /// A function that alters the behavior of the stringification process, or an array of String /// and Number that serve as a whitelist for selecting/filtering the properties of the value /// object to be included in the JSON string.<para/> /// If this value is null or not provided, all properties of the object are included in the /// resulting JSON string. /// </param> /// <param name="space"> /// The string (or the first 10 characters of the string, if it's longer than that) /// is used as white space. If this parameter is null, no white space is used. /// </param> /// <returns>The JSON string representing this <see cref="JSValue"/>.</returns> public string ToJSON(QuickJSValue replacer, string space) { if (replacer is null) { return(NativeInstance.ToJSON(Context.NativeInstance, JSValue.Undefined, space)); } if (!Context.IsCompatibleWith(replacer.Context)) { throw new ArgumentOutOfRangeException(nameof(replacer)); } return(NativeInstance.ToJSON(Context.NativeInstance, replacer.NativeInstance, space)); }
/// <summary> /// Converts a JavaScript object or value to a JSON string, optionally replacing values if /// a <paramref name="replacer"/> function is specified or optionally including only /// the specified properties if a <paramref name="replacer"/> array is specified. /// </summary> /// <param name="replacer"> /// A function that alters the behavior of the stringification process, or an array of String /// and Number that serve as a whitelist for selecting/filtering the properties of the value /// object to be included in the JSON string.<para/> /// If this value is null or not provided, all properties of the object are included in the /// resulting JSON string. /// </param> /// <param name="space"> /// Indicates the number of space characters to use as white space; /// this number is capped at 10 (if it is greater, the value is just 10). /// Values less than 1 indicate that no space should be used. /// </param> /// <param name="json"> /// When the method returns, the JSON string representing this <see cref="JSValue"/>. /// </param> /// <returns>true if the operation is successful; otherwise, false.</returns> public bool TryGetJSON(QuickJSValue replacer, int space, out string json) { if (replacer is null) { return(NativeInstance.TryGetJSON(Context.NativeInstance, JSValue.Undefined, space, out json)); } if (!Context.IsCompatibleWith(replacer.Context)) { throw new ArgumentOutOfRangeException(nameof(replacer)); } return(NativeInstance.TryGetJSON(Context.NativeInstance, replacer.NativeInstance, space, out json)); }
/// <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); }
public bool Equals(NativeObject other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return NativeInstance.Equals(other.NativeInstance) && IsDisposed == other.IsDisposed; }
/// <summary> /// Converts a JavaScript object or value to a JSON string. /// </summary> /// <param name="json"> /// When the method returns, the JSON string representing this <see cref="JSValue"/>. /// </param> /// <returns>true if the operation is successful; otherwise, false.</returns> public bool TryGetJSON(out string json) { return(NativeInstance.TryGetJSON(Context.NativeInstance, out json)); }
/// <summary> /// Converts a JavaScript object or value to a JSON string. /// </summary> /// <returns>The JSON string representing this <see cref="JSValue"/>.</returns> public string ToJSON() { return(NativeInstance.ToJSON(Context.NativeInstance)); }
public virtual int SetNativeInstance(int classid, NativeInstance ni) { Holder <NativeInstance> holder = new Holder <NativeInstance>(ni); return(NativeInstanceSupport(Interface.NIS_REGISTER, classid, holder)); }
public virtual int SetNativeInstance(int classid, NativeInstance ni) { return(Error.E_NOTIMPL); }
public virtual int SetNativeInstance(int classid, NativeInstance ni) { return Error.E_NOTIMPL; }
public virtual int SetNativeInstance(int classid, NativeInstance ni) { Holder<NativeInstance> holder = new Holder<NativeInstance>(ni); return NativeInstanceSupport(Interface.NIS_REGISTER, classid, holder); }
//if(TJSObjectHashMapEnabled()) TJSRemoveObjectHashRecord(this); /// <exception cref="Kirikiri.Tjs2.VariantException"></exception> /// <exception cref="Kirikiri.Tjs2.TJSException"></exception> protected internal virtual void FinalizeObject() { // call this object's "finalize" if (mCallFinalize && TJS.IsTarminating == false) { //funcCall( 0, mfinalize_name, mfinalize_name.hashCode(), null, 0, null, this ); FuncCall(0, mfinalize_name, null, TJS.NULL_ARG, this); } for (int i = MAX_NATIVE_CLASS - 1; i >= 0; i--) { if (mClassIDs[i] != -1) { if (mClassInstances[i] != null) { mClassInstances[i].Invalidate(); } } } mPrimaryClassInstances = null; DeleteAllMembers(); }
public override int NativeInstanceSupport(int flag, int classid, Holder<NativeInstance > pointer) { if (flag == Interface.NIS_GETINSTANCE) { // search "classid" for (int i = 0; i < MAX_NATIVE_CLASS; i++) { if (mClassIDs[i] == classid) { pointer.mValue = mClassInstances[i]; return Error.S_OK; } } return Error.E_FAIL; } else { if (flag == Interface.NIS_REGISTER) { // search for the empty place if (mPrimaryClassID == -1) { mPrimaryClassID = classid; mPrimaryClassInstances = pointer.mValue; } for (int i = 0; i < MAX_NATIVE_CLASS; i++) { if (mClassIDs[i] == -1) { // found... writes there mClassIDs[i] = classid; mClassInstances[i] = pointer.mValue; return Error.S_OK; } } return Error.E_FAIL; } } return Error.E_NOTIMPL; }
public override int GetHashCode() { return(NativeInstance.GetHashCode() * 397); }
public override int SetNativeInstance(int classid, NativeInstance ni) { // search for the empty place if (mPrimaryClassID == -1) { mPrimaryClassID = classid; mPrimaryClassInstances = ni; } for (int i = 0; i < MAX_NATIVE_CLASS; i++) { if (mClassIDs[i] == -1) { // found... writes there mClassIDs[i] = classid; mClassInstances[i] = ni; return Error.S_OK; } } return Error.E_FAIL; }