XmlSchemaObjectTable.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.Add(name,value);
  45. }
  46. internal void Set(XmlQualifiedName name, XmlSchemaObject value)
  47. {
  48. table [name] = value;
  49. }
  50. internal class XmlSchemaObjectTableEnumerator : IDictionaryEnumerator
  51. {
  52. private IDictionaryEnumerator xenum;
  53. IEnumerable tmp;
  54. XmlSchemaObjectTable table;
  55. internal XmlSchemaObjectTableEnumerator (XmlSchemaObjectTable table)
  56. {
  57. this.table = table;
  58. tmp = (IEnumerable) table.table;
  59. xenum = (IDictionaryEnumerator) tmp.GetEnumerator ();
  60. }
  61. // Properties
  62. public XmlSchemaObject Current {
  63. get {
  64. return (XmlSchemaObject) xenum.Value;
  65. }
  66. }
  67. public DictionaryEntry Entry {
  68. get { return xenum.Entry; }
  69. }
  70. public XmlQualifiedName Key {
  71. get { return (XmlQualifiedName) xenum.Key; }
  72. }
  73. public XmlSchemaObject Value {
  74. get { return (XmlSchemaObject) xenum.Value; }
  75. }
  76. // Methods
  77. public bool MoveNext()
  78. {
  79. return xenum.MoveNext();
  80. }
  81. //Explicit Interface implementation
  82. bool IEnumerator.MoveNext()
  83. {
  84. return xenum.MoveNext();
  85. }
  86. void IEnumerator.Reset()
  87. {
  88. xenum.Reset();
  89. }
  90. object IEnumerator.Current
  91. {
  92. get { return xenum.Value; }
  93. }
  94. DictionaryEntry IDictionaryEnumerator.Entry {
  95. get { return xenum.Entry; }
  96. }
  97. object IDictionaryEnumerator.Key {
  98. get { return (XmlQualifiedName) xenum.Key; }
  99. }
  100. object IDictionaryEnumerator.Value {
  101. get { return (XmlSchemaObject) xenum.Value; }
  102. }
  103. }
  104. }
  105. }