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

  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 System;
  19.    
  20.     public class EnumeratorPrototype : JSObject
  21.     {
  22.         static internal readonly EnumeratorPrototype ob = new EnumeratorPrototype(ObjectPrototype.ob);
  23.         static internal EnumeratorConstructor _constructor;
  24.        
  25.         internal EnumeratorPrototype(ObjectPrototype parent) : base(parent)
  26.         {
  27.             //this.constructor is given a value by the constructor class
  28.         }
  29.        
  30.         [JSFunctionAttribute(JSFunctionAttributeEnum.HasThisObject, JSBuiltin.Enumerator_atEnd)]
  31.         public static bool atEnd(object thisob)
  32.         {
  33.             if (thisob is EnumeratorObject)
  34.                 return ((EnumeratorObject)thisob).atEnd();
  35.             else
  36.                 throw new JScriptException(JSError.EnumeratorExpected);
  37.         }
  38.        
  39.         public static EnumeratorConstructor constructor {
  40.             get { return EnumeratorPrototype._constructor; }
  41.         }
  42.        
  43.         [JSFunctionAttribute(JSFunctionAttributeEnum.HasThisObject, JSBuiltin.Enumerator_item)]
  44.         public static object item(object thisob)
  45.         {
  46.             if (thisob is EnumeratorObject)
  47.                 return ((EnumeratorObject)thisob).item();
  48.             else
  49.                 throw new JScriptException(JSError.EnumeratorExpected);
  50.         }
  51.        
  52.         [JSFunctionAttribute(JSFunctionAttributeEnum.HasThisObject, JSBuiltin.Enumerator_moveFirst)]
  53.         public static void moveFirst(object thisob)
  54.         {
  55.             if (thisob is EnumeratorObject)
  56.                 ((EnumeratorObject)thisob).moveFirst();
  57.             else
  58.                 throw new JScriptException(JSError.EnumeratorExpected);
  59.         }
  60.        
  61.         [JSFunctionAttribute(JSFunctionAttributeEnum.HasThisObject, JSBuiltin.Enumerator_moveNext)]
  62.         public static void moveNext(object thisob)
  63.         {
  64.             if (thisob is EnumeratorObject)
  65.                 ((EnumeratorObject)thisob).moveNext();
  66.             else
  67.                 throw new JScriptException(JSError.EnumeratorExpected);
  68.         }
  69.     }
  70. }

Developer Fusion