PageRenderTime 1864ms CodeModel.GetById 39ms RepoModel.GetById 4ms app.codeStats 0ms

/mcs/class/System.Security/System.Security.Cryptography.Xml/ReferenceList.cs

https://bitbucket.org/danipen/mono
C# | 151 lines | 90 code | 32 blank | 29 comment | 2 complexity | 974c44b94d6e7aa7ef96a2b553f0d5b6 MD5 | raw file
Possible License(s): Unlicense, Apache-2.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, CC-BY-SA-3.0, GPL-2.0
  1. //
  2. // ReferenceList.cs - ReferenceList implementation for XML Encryption
  3. // http://www.w3.org/2001/04/xmlenc#sec-ReferenceList
  4. //
  5. // Author:
  6. // Tim Coleman (tim@timcoleman.com)
  7. //
  8. // Copyright (C) Tim Coleman, 2004
  9. // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. //
  30. #if NET_2_0
  31. using System.Collections;
  32. using System.Runtime.CompilerServices;
  33. using System.Xml;
  34. namespace System.Security.Cryptography.Xml {
  35. public sealed class ReferenceList : IList, ICollection, IEnumerable {
  36. #region Fields
  37. ArrayList list;
  38. #endregion // Fields
  39. #region Constructors
  40. public ReferenceList ()
  41. {
  42. list = new ArrayList ();
  43. }
  44. #endregion // Constructors
  45. #region Properties
  46. public int Count {
  47. get { return list.Count; }
  48. }
  49. object IList.this [int index] {
  50. get { return this [index]; }
  51. set { this [index] = (EncryptedReference) value; }
  52. }
  53. bool IList.IsFixedSize {
  54. get { return false; }
  55. }
  56. bool IList.IsReadOnly {
  57. get { return false; }
  58. }
  59. public bool IsSynchronized {
  60. get { return list.IsSynchronized; }
  61. }
  62. [IndexerName ("ItemOf")]
  63. public EncryptedReference this [int index] {
  64. get { return (EncryptedReference) list [index]; }
  65. set { list [index] = value; }
  66. }
  67. public object SyncRoot {
  68. get { return list.SyncRoot; }
  69. }
  70. #endregion // Properties
  71. #region Methods
  72. public int Add (object value)
  73. {
  74. if (!(value is EncryptedReference))
  75. throw new ArgumentException ("value");
  76. return list.Add (value);
  77. }
  78. public void Clear ()
  79. {
  80. list.Clear ();
  81. }
  82. public bool Contains (object value)
  83. {
  84. return list.Contains (value);
  85. }
  86. public void CopyTo (Array array, int index)
  87. {
  88. list.CopyTo (array, index);
  89. }
  90. public IEnumerator GetEnumerator ()
  91. {
  92. return list.GetEnumerator ();
  93. }
  94. public EncryptedReference Item (int index)
  95. {
  96. return (EncryptedReference) list [index];
  97. }
  98. public int IndexOf (object value)
  99. {
  100. return list.IndexOf (value);
  101. }
  102. public void Insert (int index, object value)
  103. {
  104. if (!(value is EncryptedReference))
  105. throw new ArgumentException ("value");
  106. list.Insert (index, value);
  107. }
  108. public void Remove (object value)
  109. {
  110. list.Remove (value);
  111. }
  112. public void RemoveAt (int index)
  113. {
  114. list.RemoveAt (index);
  115. }
  116. #endregion // Methods
  117. }
  118. }
  119. #endif