The Labs \ Source Viewer \ SSCLI \ Microsoft.JScript \ VBArrayPrototype

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. namespace Microsoft.JScript
  16. {
  17.    
  18.     using Microsoft.JScript.Vsa;
  19.     using System;
  20.    
  21.     public class VBArrayPrototype : JSObject
  22.     {
  23.         static internal readonly VBArrayPrototype ob = new VBArrayPrototype(FunctionPrototype.ob, ObjectPrototype.ob);
  24.         static internal VBArrayConstructor _constructor;
  25.        
  26.         internal VBArrayPrototype(FunctionPrototype funcprot, ObjectPrototype parent) : base(parent)
  27.         {
  28.             //this.constructor is given a value by the constructor class
  29.         }
  30.        
  31.         public static VBArrayConstructor constructor {
  32.             get { return VBArrayPrototype._constructor; }
  33.         }
  34.        
  35.         [JSFunctionAttribute(JSFunctionAttributeEnum.HasThisObject, JSBuiltin.VBArray_dimensions)]
  36.         public static int dimensions(object thisob)
  37.         {
  38.             if (thisob is VBArrayObject)
  39.                 return ((VBArrayObject)thisob).dimensions();
  40.             else
  41.                 throw new JScriptException(JSError.VBArrayExpected);
  42.         }
  43.        
  44.         [JSFunctionAttribute(JSFunctionAttributeEnum.HasThisObject | JSFunctionAttributeEnum.HasVarArgs, JSBuiltin.VBArray_getItem)]
  45.         public static object getItem(object thisob, params object[] args)
  46.         {
  47.             if (thisob is VBArrayObject)
  48.                 return ((VBArrayObject)thisob).getItem(args);
  49.             else
  50.                 throw new JScriptException(JSError.VBArrayExpected);
  51.         }
  52.        
  53.         [JSFunctionAttribute(JSFunctionAttributeEnum.HasThisObject, JSBuiltin.VBArray_lbound)]
  54.         public static int lbound(object thisob, object dimension)
  55.         {
  56.             if (thisob is VBArrayObject)
  57.                 return ((VBArrayObject)thisob).lbound(dimension);
  58.             else
  59.                 throw new JScriptException(JSError.VBArrayExpected);
  60.         }
  61.        
  62.         [JSFunctionAttribute(JSFunctionAttributeEnum.HasThisObject | JSFunctionAttributeEnum.HasEngine, JSBuiltin.VBArray_toArray)]
  63.         public static ArrayObject toArray(object thisob, VsaEngine engine)
  64.         {
  65.             if (thisob is VBArrayObject)
  66.                 return ((VBArrayObject)thisob).toArray(engine);
  67.             else
  68.                 throw new JScriptException(JSError.VBArrayExpected);
  69.         }
  70.        
  71.         [JSFunctionAttribute(JSFunctionAttributeEnum.HasThisObject, JSBuiltin.VBArray_ubound)]
  72.         public static int ubound(object thisob, object dimension)
  73.         {
  74.             if (thisob is VBArrayObject)
  75.                 return ((VBArrayObject)thisob).ubound(dimension);
  76.             else
  77.                 throw new JScriptException(JSError.VBArrayExpected);
  78.         }
  79.     }
  80. }

Developer Fusion