Inheritance: ISGSBase
Esempio n. 1
0
 public virtual Variable OnCompare( Variable a, Variable b )
 {
     return null;
 }
Esempio n. 2
0
 public virtual Variable OnGetIndex( Context ctx, Variable key, bool isprop )
 {
     return sgsGetPropertyByName( key, isprop );
 }
Esempio n. 3
0
 public bool SetSubItem( string key, Variable val, bool isprop )
 {
     return ctx.SetIndex( this, ctx.Var( key ), val, isprop );
 }
Esempio n. 4
0
 public bool Unset( Variable key )
 {
     return NI.Unset( _sgsEngine.ctx, var, key.var ) != 0;
 }
Esempio n. 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;
 }
Esempio n. 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;
 }
Esempio n. 7
0
 public bool SetIndex( Int64 key, Variable val )
 {
     return ctx.SetIndex( this, ctx.Var( key ), val, false );
 }
Esempio n. 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 );
        }
Esempio n. 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 );
 }
Esempio n. 10
0
 public bool SetIndex( Variable key, Variable val )
 {
     return ctx.SetIndex( this, key, val, false );
 }
Esempio n. 11
0
 public Variable GetSubItem( Variable key, bool isprop )
 {
     return ctx.GetIndex( this, key, isprop );
 }
Esempio n. 12
0
 public Variable GetProp( Variable key )
 {
     return ctx.GetIndex( this, key, true );
 }
Esempio n. 13
0
 public Variable GetIndex( Variable key )
 {
     return ctx.GetIndex( this, key, false );
 }
Esempio n. 14
0
 public virtual bool OnSetIndex( Context ctx, Variable key, Variable val, bool isprop )
 {
     return sgsSetPropertyByName( key, ctx, isprop, 1 );
 }
Esempio n. 15
0
 public bool SetProp( Variable key, Variable val )
 {
     return ctx.SetIndex( this, key, val, true );
 }
Esempio n. 16
0
 public virtual Variable OnSub( Variable a, Variable b )
 {
     return null;
 }
Esempio n. 17
0
 public bool SetProp( string key, Variable val )
 {
     return ctx.SetIndex( this, ctx.Var( key ), val, true );
 }
Esempio n. 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;
        }
Esempio n. 19
0
 public bool SetSubItem( Variable key, Variable val, bool isprop )
 {
     return ctx.SetIndex( this, key, val, isprop );
 }
Esempio n. 20
0
 public Int32 ArrayFind( Variable val )
 {
     return NI.ArrayFind( _sgsEngine.ctx, var, val.var );
 }
Esempio n. 21
0
 public Int32 ArrayRemove( Variable val, bool all )
 {
     return NI.ArrayRemove( _sgsEngine.ctx, var, val.var, all ? 1 : 0 );
 }