In System.IO:
[mono.git] / mcs / class / corlib / System.Security.AccessControl / AceEnumerator.cs
index e15cfeefcecef98c928f65de3eb15260d464abef..6d9e60df3efff95b6818cbf4103c5b16a6a730f9 100644 (file)
@@ -3,8 +3,9 @@
 //
 // Author:
 //     Dick Porter  <dick@ximian.com>
+//     Atsushi Enomoto  <atsushi@ximian.com>
 //
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -33,30 +34,34 @@ using System.Collections;
 namespace System.Security.AccessControl {
        public sealed class AceEnumerator : IEnumerator
        {
-               public GenericAce Current
+               GenericAcl owner;
+               int current = -1;
+
+               internal AceEnumerator (GenericAcl owner)
                {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+                       this.owner = owner;
                }
 
-               object IEnumerator.Current
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+               public GenericAce Current {
+                       get { return current < 0 ? null : owner [current]; }
+               }
+
+               object IEnumerator.Current {
+                       get { return Current; }
                }
                
                public bool MoveNext ()
                {
-                               throw new NotImplementedException ();
+                       if (current + 1 == owner.Count)
+                               return false;
+                       current++;
+                       return true;
                }
                
                public void Reset ()
                {
-                               throw new NotImplementedException ();
+                       current = -1;
                }
-               
        }
 }