home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 February / CMCD0205.ISO / Software / Freeware / Programare / Sharp / SharpDevelop_1.0.3.1761_Setup.exe / CSharp.Wizards.TypedHashtable.xft < prev    next >
Extensible Markup Language  |  2004-10-06  |  8KB  |  351 lines

  1. <?xml version="1.0"?>
  2. <Template author="Mike Krueger" version="1.0">
  3.     
  4.     <Config
  5.         name        = "${res:Templates.File.TypedHashTable.Name}"
  6.         icon        = "C#.File.FullFile"
  7.         category    = "C#"
  8.         defaultname = "Class${Number}.cs"
  9.         language    = "C#"
  10.     />
  11.      
  12.     <Description>${res:Templates.File.TypedHashTable.Description}</Description>
  13.  
  14.     <Properties>
  15.         <Property
  16.             name          = "KeyType"
  17.             localizedName = "${res:Templates.File.Properties.TypedHashtableWizard.KeyType}"
  18.             type          = "System.String"
  19.             category      = "${res:Templates.File.Properties.ContextCategory}"
  20.             description   = "${res:Templates.File.Properties.TypedHashtableWizard.KeyType.Description}"
  21.         />
  22.         <Property
  23.             name          = "ValueType"
  24.             localizedName = "${res:Templates.File.Properties.TypedHashtableWizard.ValueType}"
  25.             type          = "System.String"
  26.             category      = "${res:Templates.File.Properties.ContextCategory}"
  27.             description   = "${res:Templates.File.Properties.TypedHashtableWizard.ValueType.Description}"
  28.         />
  29.         <Property
  30.             name          = "Accessibility"
  31.             localizedName = "${res:Templates.File.Properties.Accessibility}"
  32.             type          = "Types:Accessibility"
  33.             category      = "${res:Templates.File.Properties.OptionCategory}"
  34.             defaultValue  = "public"
  35.             description   = "${res:Templates.File.Properties.Accessibility.Description}"
  36.         />
  37.     </Properties>
  38.     
  39.     <Types>
  40.         <Type name = "Accessibility">
  41.             <Enum name = "Public" value = "public"/>
  42.             <Enum name = "Protected" value = "protected"/>
  43.             <Enum name = "Private" value = "private"/>
  44.             <Enum name = "Internal" value = "internal"/>
  45.             <Enum name = "Protected Internal" value = "protected internal"/>
  46.             <Enum name = "Internal Protected" value = "internal protected"/>
  47.         </Type>
  48.     </Types>
  49.     
  50.     <!-- 
  51.     Special new file templates:
  52.         ${StandardNamespace}        -> Standardnamespace of the current project or FileNameWithoutExtension
  53.         ${FullName}                 -> Full generated path name
  54.         ${FileName}                 -> File name with extension
  55.         ${FileNameWithoutExtension} -> File name without extension
  56.         ${Extension}                -> Extension in the form ".cs"
  57.         ${Path}                     -> Full path of the file
  58.      -->
  59.     <Files>
  60.         <File name="${FullName}" language="C#"><![CDATA[${StandardHeader.C#}
  61.  
  62. using System;
  63. using System.Collections;
  64.  
  65. namespace ${StandardNamespace}
  66. {
  67.     ${Properties.Accessibility} class ${ClassName} : IDictionary, ICollection, IEnumerable, ICloneable
  68.     {
  69.         protected Hashtable innerHash;
  70.         
  71.         #region "Constructors"
  72.         public  ${ClassName}()
  73.         {
  74.             innerHash = new Hashtable();
  75.         }
  76.         
  77.         public ${ClassName}(${ClassName} original)
  78.         {
  79.             innerHash = new Hashtable(original.innerHash);
  80.         }
  81.         
  82.         public ${ClassName}(IDictionary dictionary)
  83.         {
  84.             innerHash = new Hashtable(dictionary);
  85.         }
  86.         
  87.         public ${ClassName}(int capacity)
  88.         {
  89.             innerHash = new Hashtable(capacity);
  90.         }
  91.         
  92.         public ${ClassName}(IDictionary dictionary, float loadFactor)
  93.         {
  94.             innerHash = new Hashtable(dictionary, loadFactor);
  95.         }
  96.         
  97.         public ${ClassName}(IHashCodeProvider codeProvider, IComparer comparer)
  98.         {
  99.             innerHash = new Hashtable(codeProvider, comparer);
  100.         }
  101.         
  102.         public ${ClassName}(int capacity, int loadFactor)
  103.         {
  104.             innerHash = new Hashtable(capacity, loadFactor);
  105.         }
  106.         
  107.         public ${ClassName}(IDictionary dictionary, IHashCodeProvider codeProvider, IComparer comparer)
  108.         {
  109.             innerHash = new Hashtable(dictionary, codeProvider, comparer);
  110.         }
  111.         
  112.         public ${ClassName}(int capacity, IHashCodeProvider codeProvider, IComparer comparer)
  113.         {
  114.             innerHash = new Hashtable(capacity, codeProvider, comparer);
  115.         }
  116.         
  117.         public ${ClassName}(IDictionary dictionary, float loadFactor, IHashCodeProvider codeProvider, IComparer comparer)
  118.         {
  119.             innerHash = new Hashtable(dictionary, loadFactor, codeProvider, comparer);
  120.         }
  121.         
  122.         public ${ClassName}(int capacity, float loadFactor, IHashCodeProvider codeProvider, IComparer comparer)
  123.         {
  124.             innerHash = new Hashtable(capacity, loadFactor, codeProvider, comparer);
  125.         }
  126.         #endregion
  127.  
  128.         #region Implementation of IDictionary
  129.         public ${ClassName}Enumerator GetEnumerator()
  130.         {
  131.             return new ${ClassName}Enumerator(this);
  132.         }
  133.         
  134.         System.Collections.IDictionaryEnumerator IDictionary.GetEnumerator()
  135.         {
  136.             return new ${ClassName}Enumerator(this);
  137.         }
  138.         
  139.         IEnumerator IEnumerable.GetEnumerator()
  140.         {
  141.             return GetEnumerator();
  142.         }
  143.         
  144.         public void Remove(${Properties.KeyType} key)
  145.         {
  146.             innerHash.Remove(key);
  147.         }
  148.         
  149.         void IDictionary.Remove(object key)
  150.         {
  151.             Remove ((${Properties.KeyType})key);
  152.         }
  153.         
  154.         public bool Contains(${Properties.KeyType} key)
  155.         {
  156.             return innerHash.Contains(key);
  157.         }
  158.         
  159.         bool IDictionary.Contains(object key)
  160.         {
  161.             return Contains((${Properties.KeyType})key);
  162.         }
  163.         
  164.         public void Clear()
  165.         {
  166.             innerHash.Clear();        
  167.         }
  168.         
  169.         public void Add(${Properties.KeyType} key, ${Properties.ValueType} value)
  170.         {
  171.             innerHash.Add(key, value);
  172.         }
  173.         
  174.         void IDictionary.Add(object key, object value)
  175.         {
  176.             Add ((${Properties.KeyType})key, (${Properties.ValueType})value);
  177.         }
  178.         
  179.         public bool IsReadOnly {
  180.             get {
  181.                 return innerHash.IsReadOnly;
  182.             }
  183.         }
  184.         
  185.         public ${Properties.ValueType} this[${Properties.KeyType} key] {
  186.             get {
  187.                 return (${Properties.ValueType}) innerHash[key];
  188.             }
  189.             set {
  190.                 innerHash[key] = value;
  191.             }
  192.         }
  193.         
  194.         object IDictionary.this[object key] {
  195.             get {
  196.                 return this[(${Properties.KeyType})key];
  197.             }
  198.             set {
  199.                 this[(${Properties.KeyType})key] = (${Properties.ValueType})value;
  200.             }
  201.         }
  202.         
  203.         public System.Collections.ICollection Values {
  204.             get {
  205.                 return innerHash.Values;
  206.             }
  207.         }
  208.         
  209.         public System.Collections.ICollection Keys {
  210.             get {
  211.                 return innerHash.Keys;
  212.             }
  213.         }
  214.         
  215.         public bool IsFixedSize {
  216.             get {
  217.                 return innerHash.IsFixedSize;
  218.             }
  219.         }
  220.         #endregion
  221.         
  222.         #region Implementation of ICollection
  223.         public void CopyTo(System.Array array, int index)
  224.         {
  225.             innerHash.CopyTo (array, index);
  226.         }
  227.         
  228.         public bool IsSynchronized {
  229.             get {
  230.                 return innerHash.IsSynchronized;
  231.             }
  232.         }
  233.         
  234.         public int Count {
  235.             get {
  236.                 return innerHash.Count;
  237.             }
  238.         }
  239.         
  240.         public object SyncRoot {
  241.             get {
  242.                 return innerHash.SyncRoot;
  243.             }
  244.         }
  245.         #endregion
  246.         
  247.         #region Implementation of ICloneable
  248.         public ${ClassName} Clone()
  249.         {
  250.             ${ClassName} clone = new ${ClassName}();
  251.             clone.innerHash = (Hashtable) innerHash.Clone();
  252.             return clone;
  253.         }
  254.         
  255.         object ICloneable.Clone()
  256.         {
  257.             return Clone();
  258.         }
  259.         #endregion
  260.         
  261.         #region "HashTable Methods"
  262.         public bool ContainsKey(${Properties.KeyType} key)
  263.         {
  264.             return innerHash.ContainsKey(key);
  265.         }
  266.         
  267.         public bool ContainsValue(${Properties.ValueType} value)
  268.         {
  269.             return innerHash.ContainsValue(value);
  270.         }
  271.         
  272.         public static ${ClassName} Synchronized(${ClassName} nonSync)
  273.         {
  274.             ${ClassName} sync = new ${ClassName}();
  275.             sync.innerHash = Hashtable.Synchronized(nonSync.innerHash);
  276.             return sync;
  277.         }
  278.         #endregion
  279.  
  280.         internal Hashtable InnerHash {
  281.             get {
  282.                 return innerHash;
  283.             }
  284.         }
  285.     }
  286.     
  287.     public class ${ClassName}Enumerator : IDictionaryEnumerator
  288.     {
  289.         private IDictionaryEnumerator innerEnumerator;
  290.         
  291.         internal ${ClassName}Enumerator(${ClassName} enumerable)
  292.         {
  293.             innerEnumerator = enumerable.InnerHash.GetEnumerator();
  294.         }
  295.         
  296.         #region Implementation of IDictionaryEnumerator
  297.         public ${Properties.KeyType} Key {
  298.             get {
  299.                 return (${Properties.KeyType})innerEnumerator.Key;
  300.             }
  301.         }
  302.         
  303.         object IDictionaryEnumerator.Key {
  304.             get {
  305.                 return Key;
  306.             }
  307.         }
  308.         
  309.         public ${Properties.ValueType} Value {
  310.             get {
  311.                 return (${Properties.ValueType})innerEnumerator.Value;
  312.             }
  313.         }
  314.         
  315.         object IDictionaryEnumerator.Value {
  316.             get {
  317.                 return Value;
  318.             }
  319.         }
  320.         
  321.         public System.Collections.DictionaryEntry Entry {
  322.             get {
  323.                 return innerEnumerator.Entry;
  324.             }
  325.         }
  326.         #endregion
  327.         
  328.         #region Implementation of IEnumerator
  329.         public void Reset()
  330.         {
  331.             innerEnumerator.Reset();
  332.         }
  333.         
  334.         public bool MoveNext()
  335.         {
  336.             return innerEnumerator.MoveNext();
  337.         }
  338.         
  339.         public object Current {
  340.             get {
  341.                 return innerEnumerator.Current;
  342.             }
  343.         }
  344.         #endregion
  345.     }
  346. }]]></File>
  347.     </Files>
  348.     
  349.     <AdditionalOptions/>
  350. </Template>
  351.