2
0

XmlSchemaObjectTable.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // Author: Dwivedi, Ajay kumar
  2. // [email protected]
  3. using System;
  4. using System.Collections;
  5. using System.Xml;
  6. namespace System.Xml.Schema
  7. {
  8. /// <summary>
  9. /// Summary description for XmlSchemaObjectTable.
  10. /// </summary>
  11. public class XmlSchemaObjectTable
  12. {
  13. private Hashtable table;
  14. internal XmlSchemaObjectTable ()
  15. {
  16. table = new Hashtable();
  17. }
  18. public int Count
  19. {
  20. get{ return table.Count; }
  21. }
  22. public XmlSchemaObject this [XmlQualifiedName name]
  23. {
  24. get{ return (XmlSchemaObject) table [name]; }
  25. }
  26. public ICollection Names
  27. {
  28. get{ return table.Keys; }
  29. }
  30. public ICollection Values
  31. {
  32. get{ return table.Values; }
  33. }
  34. public bool Contains (XmlQualifiedName name)
  35. {
  36. return table.Contains (name);
  37. }
  38. public IDictionaryEnumerator GetEnumerator ()
  39. {
  40. return new XmlSchemaObjectTableEnumerator (this);
  41. }
  42. internal void Add (XmlQualifiedName name, XmlSchemaObject value)
  43. {
  44. table [name] = value;
  45. }
  46. internal void Clear ()
  47. {
  48. table.Clear ();
  49. }
  50. internal void Set (XmlQualifiedName name, XmlSchemaObject value)
  51. {
  52. table [name] = value;
  53. }
  54. internal class XmlSchemaObjectTableEnumerator : IDictionaryEnumerator
  55. {
  56. private IDictionaryEnumerator xenum;
  57. IEnumerable tmp;
  58. XmlSchemaObjectTable table;
  59. internal XmlSchemaObjectTableEnumerator (XmlSchemaObjectTable table)
  60. {
  61. this.table = table;
  62. tmp = (IEnumerable) table.table;
  63. xenum = (IDictionaryEnumerator) tmp.GetEnumerator ();
  64. }
  65. // Properties
  66. public XmlSchemaObject Current {
  67. get {
  68. return (XmlSchemaObject) xenum.Value;
  69. }
  70. }
  71. public DictionaryEntry Entry {
  72. get { return xenum.Entry; }
  73. }
  74. public XmlQualifiedName Key {
  75. get { return (XmlQualifiedName) xenum.Key; }
  76. }
  77. public XmlSchemaObject Value {
  78. get { return (XmlSchemaObject) xenum.Value; }
  79. }
  80. // Methods
  81. public bool MoveNext()
  82. {
  83. return xenum.MoveNext();
  84. }
  85. //Explicit Interface implementation
  86. bool IEnumerator.MoveNext()
  87. {
  88. return xenum.MoveNext();
  89. }
  90. void IEnumerator.Reset()
  91. {
  92. xenum.Reset();
  93. }
  94. object IEnumerator.Current
  95. {
  96. get { return xenum.Entry; }
  97. }
  98. DictionaryEntry IDictionaryEnumerator.Entry {
  99. get { return xenum.Entry; }
  100. }
  101. object IDictionaryEnumerator.Key {
  102. get { return (XmlQualifiedName) xenum.Key; }
  103. }
  104. object IDictionaryEnumerator.Value {
  105. get { return (XmlSchemaObject) xenum.Value; }
  106. }
  107. }
  108. }
  109. }