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

  1. <?xml version="1.0"?>
  2. <Template author="Mike Krueger" version="1.0">
  3.     
  4.     <Config
  5.         name        = "${res:Templates.File.TypedCollection.Name}"
  6.         icon        = "VB.File.FullFile"
  7.         category    = "VB"
  8.         defaultname = "TypedCollection${Number}.vb"
  9.         language    = "VBNET"
  10.     />
  11.     
  12.     <Description>${res:Templates.File.TypedCollection.Description}</Description>
  13.     
  14.     <Properties>
  15.         <Property
  16.             name          = "ItemType"
  17.             localizedName = "${res:Templates.File.Properties.TypedCollectionWizard.ItemType}"
  18.             type          = "System.String"
  19.             category      = "${res:Templates.File.Properties.ContextCategory}"
  20.             description   = "${res:Templates.File.Properties.TypedCollectionWizard.ItemType.Description}"
  21.         />
  22.         <Property
  23.             name          = "Accessibility"
  24.             localizedName = "${res:Templates.File.Properties.Accessibility}"
  25.             type          = "Types:Accessibility"
  26.             category      = "${res:Templates.File.Properties.OptionCategory}"
  27.             defaultValue  = "Public"
  28.             description   = "${res:Templates.File.Properties.Accessibility.Description}"
  29.         />
  30.         <Property
  31.             name          = "GenerateDocumentation"
  32.             localizedName = "${res:Templates.File.Properties.GenerateDocumentation}"
  33.             type          = "System.Boolean"
  34.             category      = "${res:Templates.File.Properties.OptionCategory}"
  35.             defaultValue  = "True"
  36.             description   = "${res:Templates.File.Properties.GenerateDocumentation}"
  37.         />
  38.     </Properties>
  39.     
  40.     <Types>
  41.         <Type name = "Accessibility">
  42.             <Enum name = "Public" value = "Public"/>
  43.             <Enum name = "Protected" value = "Protected"/>
  44.             <Enum name = "Private" value = "Private"/>
  45.             <Enum name = "Friend" value = "Friend"/>
  46.             <Enum name = "Protected Friend" value = "Protected Friend"/>
  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="VBNET"><![CDATA[${StandardHeader.VBNET}
  61.  
  62. Imports System
  63. Imports System.Collections
  64.  
  65. Namespace ${StandardNamespace}
  66.     
  67. <%if (GenerateDocumentation) {%>    '<summary>
  68.     '    <para>
  69.     '      A collection that stores <see cref='.${Properties.ItemType}'/> objects.
  70.     '   </para>
  71.     '</summary>
  72.     '<seealso cref='.${ClassName}'/>
  73. <%}%>    <Serializable()>  _
  74.     ${Properties.Accessibility} Class ${ClassName}
  75.         Inherits CollectionBase
  76.         
  77. <%if (GenerateDocumentation) {%>        '<summary>
  78.         '    <para>
  79.         '      Initializes a new instance of <see cref='.${ClassName}'/>.
  80.         '   </para>
  81.         '</summary>
  82. <%}%>        Public Sub New()
  83.             MyBase.New
  84.         End Sub
  85.         
  86. <%if (GenerateDocumentation) {%>        '<summary>
  87.         '    <para>
  88.         '      Initializes a new instance of <see cref='.${ClassName}'/> based on another <see cref='.${ClassName}'/>.
  89.         '   </para>
  90.         '</summary>
  91.         '<param name='value'>
  92.         '      A <see cref='.${ClassName}'/> from which the contents are copied
  93.         '</param>
  94. <%}%>        Public Sub New(ByVal value As ${ClassName})
  95.             MyBase.New
  96.             Me.AddRange(value)
  97.         End Sub
  98.         
  99. <%if (GenerateDocumentation) {%>        '<summary>
  100.         '    <para>
  101.         '      Initializes a new instance of <see cref='.${ClassName}'/> containing any array of <see cref='.${Properties.ItemType}'/> objects.
  102.         '   </para>
  103.         '</summary>
  104.         '<param name='value'>
  105.         '      A array of <see cref='.${Properties.ItemType}'/> objects with which to intialize the collection
  106.         '</param>
  107. <%}%>        Public Sub New(ByVal value() As ${Properties.ItemType})
  108.             MyBase.New
  109.             Me.AddRange(value)
  110.         End Sub
  111.         
  112. <%if (GenerateDocumentation) {%>        '<summary>
  113.         '<para>Represents the entry at the specified index of the <see cref='.${Properties.ItemType}'/>.</para>
  114.         '</summary>
  115.         '<param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
  116.         '<value>
  117.         '   <para> The entry at the specified index of the collection.</para>
  118.         '</value>
  119.         '<exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
  120. <%}%>        Public Default Property Item(ByVal index As Integer) As ${Properties.ItemType}
  121.             Get
  122.                 Return CType(List(index),${Properties.ItemType})
  123.             End Get
  124.             Set
  125.                 List(index) = value
  126.             End Set
  127.         End Property
  128.         
  129. <%if (GenerateDocumentation) {%>        '<summary>
  130.         '   <para>Adds a <see cref='.${Properties.ItemType}'/> with the specified value to the 
  131.         '   <see cref='.${ClassName}'/> .</para>
  132.         '</summary>
  133.         '<param name='value'>The <see cref='.${Properties.ItemType}'/> to add.</param>
  134.         '<returns>
  135.         '   <para>The index at which the new element was inserted.</para>
  136.         '</returns>
  137.         '<seealso cref='.${ClassName}.AddRange'/>
  138. <%}%>        Public Function Add(ByVal value As ${Properties.ItemType}) As Integer
  139.             Return List.Add(value)
  140.         End Function
  141.         
  142. <%if (GenerateDocumentation) {%>        '<summary>
  143.         '<para>Copies the elements of an array to the end of the <see cref='.${ClassName}'/>.</para>
  144.         '</summary>
  145.         '<param name='value'>
  146.         '   An array of type <see cref='.${Properties.ItemType}'/> containing the objects to add to the collection.
  147.         '</param>
  148.         '<returns>
  149.         '  <para>None.</para>
  150.         '</returns>
  151.         '<seealso cref='.${ClassName}.Add'/>
  152. <%}%>        Public Overloads Sub AddRange(ByVal value() As ${Properties.ItemType})
  153.             Dim i As Integer = 0
  154.             Do While (i < value.Length)
  155.                 Me.Add(value(i))
  156.                 i = (i + 1)
  157.             Loop
  158.         End Sub
  159.         
  160. <%if (GenerateDocumentation) {%>        '<summary>
  161.         '    <para>
  162.         '      Adds the contents of another <see cref='.${ClassName}'/> to the end of the collection.
  163.         '   </para>
  164.         '</summary>
  165.         '<param name='value'>
  166.         '   A <see cref='.${ClassName}'/> containing the objects to add to the collection.
  167.         '</param>
  168.         '<returns>
  169.         '  <para>None.</para>
  170.         '</returns>
  171.         '<seealso cref='.${ClassName}.Add'/>
  172. <%}%>        Public Overloads Sub AddRange(ByVal value As ${ClassName})
  173.             Dim i As Integer = 0
  174.             Do While (i < value.Count)
  175.                 Me.Add(value(i))
  176.                 i = (i + 1)
  177.             Loop
  178.         End Sub
  179.         
  180. <%if (GenerateDocumentation) {%>        '<summary>
  181.         '<para>Gets a value indicating whether the 
  182.         '   <see cref='.${ClassName}'/> contains the specified <see cref='.${Properties.ItemType}'/>.</para>
  183.         '</summary>
  184.         '<param name='value'>The <see cref='.${Properties.ItemType}'/> to locate.</param>
  185.         '<returns>
  186.         '<para><see langword='true'/> if the <see cref='.${Properties.ItemType}'/> is contained in the collection; 
  187.         '  otherwise, <see langword='false'/>.</para>
  188.         '</returns>
  189.         '<seealso cref='.${ClassName}.IndexOf'/>
  190. <%}%>        Public Function Contains(ByVal value As ${Properties.ItemType}) As Boolean
  191.             Return List.Contains(value)
  192.         End Function
  193.         
  194. <%if (GenerateDocumentation) {%>        '<summary>
  195.         '<para>Copies the <see cref='.${ClassName}'/> values to a one-dimensional <see cref='System.Array'/> instance at the 
  196.         '   specified index.</para>
  197.         '</summary>
  198.         '<param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='.${ClassName}'/> .</para></param>
  199.         '<param name='index'>The index in <paramref name='array'/> where copying begins.</param>
  200.         '<returns>
  201.         '  <para>None.</para>
  202.         '</returns>
  203.         '<exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='.${ClassName}'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception>
  204.         '<exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
  205.         '<exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
  206.         '<seealso cref='System.Array'/>
  207. <%}%>        Public Sub CopyTo(ByVal array() As ${Properties.ItemType}, ByVal index As Integer)
  208.             List.CopyTo(array, index)
  209.         End Sub
  210.         
  211. <%if (GenerateDocumentation) {%>        '<summary>
  212.         '   <para>Returns the index of a <see cref='.${Properties.ItemType}'/> in 
  213.         '      the <see cref='.${ClassName}'/> .</para>
  214.         '</summary>
  215.         '<param name='value'>The <see cref='.${Properties.ItemType}'/> to locate.</param>
  216.         '<returns>
  217.         '<para>The index of the <see cref='.${Properties.ItemType}'/> of <paramref name='value'/> in the 
  218.         '<see cref='.${ClassName}'/>, if found; otherwise, -1.</para>
  219.         '</returns>
  220.         '<seealso cref='.${ClassName}.Contains'/>
  221. <%}%>        Public Function IndexOf(ByVal value As ${Properties.ItemType}) As Integer
  222.             Return List.IndexOf(value)
  223.         End Function
  224.         
  225. <%if (GenerateDocumentation) {%>        '<summary>
  226.         '<para>Inserts a <see cref='.${Properties.ItemType}'/> into the <see cref='.${ClassName}'/> at the specified index.</para>
  227.         '</summary>
  228.         '<param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param>
  229.         '<param name=' value'>The <see cref='.${Properties.ItemType}'/> to insert.</param>
  230.         '<returns><para>None.</para></returns>
  231.         '<seealso cref='.${ClassName}.Add'/>
  232. <%}%>        Public Sub Insert(ByVal index As Integer, ByVal value As ${Properties.ItemType})
  233.             List.Insert(index, value)
  234.         End Sub
  235.         
  236. <%if (GenerateDocumentation) {%>        '<summary>
  237.         '   <para>Returns an enumerator that can iterate through 
  238.         '      the <see cref='.${ClassName}'/> .</para>
  239.         '</summary>
  240.         '<returns><para>None.</para></returns>
  241.         '<seealso cref='System.Collections.IEnumerator'/>
  242. <%}%>        Public Shadows Function GetEnumerator() As ${Properties.ItemType}Enumerator
  243.             Return New ${Properties.ItemType}Enumerator(Me)
  244.         End Function
  245.         
  246. <%if (GenerateDocumentation) {%>        '<summary>
  247.         '   <para> Removes a specific <see cref='.${Properties.ItemType}'/> from the 
  248.         '   <see cref='.${ClassName}'/> .</para>
  249.         '</summary>
  250.         '<param name='value'>The <see cref='.${Properties.ItemType}'/> to remove from the <see cref='.${ClassName}'/> .</param>
  251.         '<returns><para>None.</para></returns>
  252.         '<exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
  253. <%}%>        Public Sub Remove(ByVal value As ${Properties.ItemType})
  254.             List.Remove(value)
  255.         End Sub
  256.         
  257.         Public Class ${Properties.ItemType}Enumerator
  258.             Implements IEnumerator
  259.             
  260.             Private baseEnumerator As IEnumerator
  261.             
  262.             Private temp As IEnumerable
  263.             
  264.             Public Sub New(ByVal mappings As ${ClassName})
  265.                 MyBase.New
  266.                 Me.temp = CType(mappings,IEnumerable)
  267.                 Me.baseEnumerator = temp.GetEnumerator
  268.             End Sub
  269.             
  270.             Public ReadOnly Property Current As ${Properties.ItemType}
  271.                 Get
  272.                     Return CType(baseEnumerator.Current,${Properties.ItemType})
  273.                 End Get
  274.             End Property
  275.             
  276.             ReadOnly Property IEnumerator_Current As Object Implements IEnumerator.Current
  277.                 Get
  278.                     Return baseEnumerator.Current
  279.                 End Get
  280.             End Property
  281.             
  282.             Public Function MoveNext() As Boolean
  283.                 Return baseEnumerator.MoveNext
  284.             End Function
  285.             
  286.             Function IEnumerator_MoveNext() As Boolean Implements IEnumerator.MoveNext
  287.                 Return baseEnumerator.MoveNext
  288.             End Function
  289.             
  290.             Public Sub Reset()
  291.                 baseEnumerator.Reset
  292.             End Sub
  293.             
  294.             Sub IEnumerator_Reset() Implements IEnumerator.Reset
  295.                 baseEnumerator.Reset
  296.             End Sub
  297.         End Class
  298.     End Class
  299. End Namespace
  300. ]]></File>
  301.     </Files>
  302.     
  303.     <AdditionalOptions/>
  304. </Template>
  305.