Inheritance: ISGSBase
Example #1
0
 public virtual Variable OnCompare( Variable a, Variable b )
 {
     return null;
 }
Example #2
0
 public virtual Variable OnGetIndex( Context ctx, Variable key, bool isprop )
 {
     return sgsGetPropertyByName( key, isprop );
 }
Example #3
0
 public bool SetSubItem( string key, Variable val, bool isprop )
 {
     return ctx.SetIndex( this, ctx.Var( key ), val, isprop );
 }
Example #4
0
 public bool Unset( Variable key )
 {
     return NI.Unset( _sgsEngine.ctx, var, key.var ) != 0;
 }
Example #5
0
 public bool sgsSetPropertyByName( Variable key, Variable val, bool isprop )
 {
     _sgsEngine.Push( val );
     bool ret = sgsSetPropertyByName( key, _sgsEngine, isprop, _sgsEngine.StackSize() - 1 );
     _sgsEngine.Pop( 1 );
     return ret;
 }
Example #6
0
 public string ConvertToString()
 {
     Variable v2 = new Variable( ctx, var );
     NI.ToStringBufP( ctx.ctx, ref v2.var );
     string s = v2.GetString();
     v2.Release();
     return s;
 }
Example #7
0
 public bool SetIndex( Int64 key, Variable val )
 {
     return ctx.SetIndex( this, ctx.Var( key ), val, false );
 }
Example #8
0
        // callback implementation helpers
        public Variable sgsGetPropertyByName( Variable key, bool isprop )
        {
            SGSClassInfo cinfo = GetClassInfo();
            SGSPropInfo propinfo;
            if( !cinfo.props.TryGetValue( key, out propinfo ) || !propinfo.canRead )
            {
                if( backingStore != null )
                    return backingStore.GetSubItem( key, isprop );
                return null;
            }

            object obj;
            if( propinfo.info is FieldInfo )
                obj = (propinfo.info as FieldInfo).GetValue( this );
            else // PropertyInfo
                obj = (propinfo.info as PropertyInfo).GetValue( this, null );
            return _sgsEngine.ObjVar( obj );
        }
Example #9
0
 public void IterGetKeyValue( out Variable key, out Variable val )
 {
     NI.Variable outkey, outval;
     NI.IterGetData( _sgsEngine.ctx, var, out outkey, out outval );
     key = _sgsEngine.Var( outkey, false );
     val = _sgsEngine.Var( outval, false );
 }
Example #10
0
 public bool SetIndex( Variable key, Variable val )
 {
     return ctx.SetIndex( this, key, val, false );
 }
Example #11
0
 public Variable GetSubItem( Variable key, bool isprop )
 {
     return ctx.GetIndex( this, key, isprop );
 }
Example #12
0
 public Variable GetProp( Variable key )
 {
     return ctx.GetIndex( this, key, true );
 }
Example #13
0
 public Variable GetIndex( Variable key )
 {
     return ctx.GetIndex( this, key, false );
 }
Example #14
0
 public virtual bool OnSetIndex( Context ctx, Variable key, Variable val, bool isprop )
 {
     return sgsSetPropertyByName( key, ctx, isprop, 1 );
 }
Example #15
0
 public bool SetProp( Variable key, Variable val )
 {
     return ctx.SetIndex( this, key, val, true );
 }
Example #16
0
 public virtual Variable OnSub( Variable a, Variable b )
 {
     return null;
 }
Example #17
0
 public bool SetProp( string key, Variable val )
 {
     return ctx.SetIndex( this, ctx.Var( key ), val, true );
 }
Example #18
0
        public bool sgsSetPropertyByName( Variable key, Context ctx, bool isprop, int valueOnStack )
        {
            SGSClassInfo cinfo = GetClassInfo();
            SGSPropInfo propinfo;
            if( !cinfo.props.TryGetValue( key, out propinfo ) || !propinfo.canWrite )
            {
                if( backingStore != null )
                    return backingStore.SetSubItem( key, ctx.StackItem( valueOnStack ), isprop );
                return false;
            }
            if( propinfo.parseVarMethod == null )
                throw new SGSException( RC.ENOTFND, string.Format(
                    "Property cannot be set - no Context.ParseVar method exists that supports this type ({0})", propinfo.propType ) );

            object[] args = new object[]{ null, ctx.StackItem( valueOnStack ) };
            propinfo.parseVarMethod.Invoke( ctx, args );
            if( propinfo.info is FieldInfo )
                (propinfo.info as FieldInfo).SetValue( this, args[0] );
            else // PropertyInfo
                (propinfo.info as PropertyInfo).SetValue( this, args[0], null );
            return true;
        }
Example #19
0
 public bool SetSubItem( Variable key, Variable val, bool isprop )
 {
     return ctx.SetIndex( this, key, val, isprop );
 }
Example #20
0
 public Int32 ArrayFind( Variable val )
 {
     return NI.ArrayFind( _sgsEngine.ctx, var, val.var );
 }
Example #21
0
 public Int32 ArrayRemove( Variable val, bool all )
 {
     return NI.ArrayRemove( _sgsEngine.ctx, var, val.var, all ? 1 : 0 );
 }