Merge pull request #439 from mono-soc-2012/garyb/iconfix
[mono.git] / mcs / class / corlib / System.Security.AccessControl / GenericAcl.cs
index 9bc85d7d9db22baa0e063f974e594b6626ddee4f..8d1628b780b7cf2e3c3e8530bfa0d3cc3651c290 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
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
-
 using System.Collections;
 
 namespace System.Security.AccessControl {
        public abstract class GenericAcl : ICollection, IEnumerable
        {
-               protected GenericAcl ()
-               {
-               }
-               
                public static readonly byte AclRevision;
                public static readonly byte AclRevisionDS;
                public static readonly int MaxBinaryLength;
                
-               public abstract int BinaryLength
+               static GenericAcl ()
                {
-                       get;
+                       // FIXME: they are likely platform dependent (on windows)
+                       AclRevision = 2;
+                       AclRevisionDS = 4;
+                       MaxBinaryLength = 0x10000;
                }
-               
-               public abstract int Count
+
+               protected GenericAcl ()
                {
-                       get;
                }
                
-               public bool IsSynchronized
-               {
-                       get {
-                               return(false);
-                       }
+               public abstract int BinaryLength { get; }
+               
+               public abstract int Count { get; }
+               
+               public bool IsSynchronized {
+                       get { return false; }
                }
                
-               public abstract GenericAce this[int index]
-               {
+               public abstract GenericAce this [int index] {
                        get;
                        set;
                }
                
-               public abstract byte Revision
-               {
-                       get;
-               }
+               public abstract byte Revision { get; }
                
-               public object SyncRoot
-               {
-                       get {
-                               return(null);
-                       }
+               public virtual object SyncRoot {
+                       get { return this; }
                }
                
-               public void CopyTo (GenericAce[] array, int index)
+               public void CopyTo (GenericAce [] array, int index)
                {
-                       throw new NotImplementedException ();
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if (index < 0 || array.Length - index < Count)
+                               throw new ArgumentOutOfRangeException ("index", "Index must be non-negative integer and must not exceed array length - count");
+                       for (int i = 0; i < Count; i++)
+                               array [i + index] = this [i];
                }
 
                void ICollection.CopyTo (Array array, int index)
                {
-                       throw new NotImplementedException ();
+                       CopyTo ((GenericAce []) array, index);
                }
                
-               
                public abstract void GetBinaryForm (byte[] binaryForm, int offset);
+               
                public AceEnumerator GetEnumerator ()
                {
-                       throw new NotImplementedException ();
+                       return new AceEnumerator (this);
                }
 
                IEnumerator IEnumerable.GetEnumerator ()
                {
-                       throw new NotImplementedException ();
+                       return GetEnumerator ();
                }
+               
+               internal abstract string GetSddlForm(ControlFlags sdFlags,
+                                                    bool isDacl);
        }
 }
 
-#endif