'**************************************************
' FILE : BBCodeAttributeDictionary.vb
' AUTHOR : Paulo Santos
' CREATION : 4/29/2009 11:39:24 AM
' COPYRIGHT : Copyright © 2009
' PJ on Development
' All Rights Reserved.
'
' Description:
' TODO: Add file description
'
' Change log:
' 0.1 4/29/2009 11:39:24 AM
' Paulo Santos
' Created.
'***************************************************
'''
''' Represents a collection of Attributes.
'''
Public Class BBCodeAttributeDictionary
Implements IDictionary(Of String, String)
Dim __dic As IDictionary(Of String, String)
''' Initializes an instance of the class.
''' This is the default constructor for this class.
Public Sub New()
__dic = New Dictionary(Of String, String)
End Sub
'''
''' Removes all items from the .
'''
Public Sub Clear() Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).Clear
__dic.Clear()
End Sub
'''
''' Copies the elements of the to an System.Array, starting at a particular System.Array index.
'''
''' The one-dimensional System.Array that is the destination of the elements copied from . The System.Array must have zero-based indexing.
''' The zero-based index in array at which copying begins.
'''
Private Sub CopyTo(ByVal array() As System.Collections.Generic.KeyValuePair(Of String, String), ByVal arrayIndex As Integer) Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).CopyTo
__dic.CopyTo(array, arrayIndex)
End Sub
'''
''' Gets the number of elements contained in the .
'''
''' The number of elements contained in the .
Public ReadOnly Property Count() As Integer Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).Count
Get
Return __dic.Count
End Get
End Property
'''
''' Gets a value indicating whether the is read-only.
'''
''' true if the is read-only; otherwise, false.
Public ReadOnly Property IsReadOnly() As Boolean Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).IsReadOnly
Get
Return __dic.IsReadOnly
End Get
End Property
'''
''' Adds an element with the provided key and value to the .
'''
''' The object to use as the key of the element to add.
''' The object to use as the value of the element to add.
Public Sub Add(ByVal key As String, ByVal value As String) Implements System.Collections.Generic.IDictionary(Of String, String).Add
__dic.Add(key.ToUpperInvariant(), value)
End Sub
'''
''' Determines whether the contains an element with the specified key.
'''
''' The key to locate in the .
''' True if the contains an element with the key; otherwise, False.
'''
Public Function ContainsKey(ByVal key As String) As Boolean Implements System.Collections.Generic.IDictionary(Of String, String).ContainsKey
Return __dic.ContainsKey(key.ToUpperInvariant())
End Function
'''
''' Gets or sets the element with the specified key.
'''
''' The key of the element to get or set.
''' The element with the specified key.
Default Public Property Item(ByVal key As String) As String Implements System.Collections.Generic.IDictionary(Of String, String).Item
Get
Return __dic.Item(key.ToUpperInvariant())
End Get
Set(ByVal value As String)
__dic.Item(key.ToUpperInvariant()) = value
End Set
End Property
'''
''' Gets an containing the keys of the .
'''
''' An containing the keys of the object that implements .
Public ReadOnly Property Keys() As System.Collections.Generic.ICollection(Of String) Implements System.Collections.Generic.IDictionary(Of String, String).Keys
Get
Return __dic.Keys
End Get
End Property
'''
''' Removes the element with the specified key from the .
'''
''' The key of the element to remove.
''' True if the element is successfully removed; otherwise, False. This method also returns False if key was not found in the original .
'''
Public Function Remove(ByVal key As String) As Boolean Implements System.Collections.Generic.IDictionary(Of String, String).Remove
Return __dic.Remove(key)
End Function
'''
''' Gets the value associated with the specified key.
'''
''' The key whose value to get.
''' When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.
''' True if the object that implements contains an element with the specified key; otherwise, False.
'''
Public Function TryGetValue(ByVal key As String, ByRef value As String) As Boolean Implements System.Collections.Generic.IDictionary(Of String, String).TryGetValue
Return __dic.TryGetValue(key, value)
End Function
'''
''' Gets an containing the values in the .
'''
''' An containing the values in the object that implements .
Public ReadOnly Property Values() As System.Collections.Generic.ICollection(Of String) Implements System.Collections.Generic.IDictionary(Of String, String).Values
Get
Return __dic.Values
End Get
End Property
'''
''' Returns an enumerator that iterates through the collection.
'''
''' A System.Collections.Generic.IEnumerator(Of T) that can be used to iterate through the collection.
Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, String)) Implements System.Collections.Generic.IEnumerable(Of System.Collections.Generic.KeyValuePair(Of String, String)).GetEnumerator
Return __dic.GetEnumerator()
End Function
'''
''' Adds an item to the .
'''
''' The attribute to be added.
Private Sub Add(ByVal item As System.Collections.Generic.KeyValuePair(Of String, String)) Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).Add
__dic.Add(item.Key.ToUpperInvariant(), item.Value)
End Sub
'''
''' Removes the first occurrence of a specific object from the .
'''
''' The object to remove from the .
''' True if item was successfully removed from the ; otherwise, False. This method also returns False if item is not found in the original .
'''
Private Function Remove(ByVal item As System.Collections.Generic.KeyValuePair(Of String, String)) As Boolean Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).Remove
Return __dic.Remove(item)
End Function
'''
''' Determines whether the contains a specific value.
'''
''' The object to locate in the .
''' True if item is found in the ; otherwise, False.
'''
Private Function Contains(ByVal item As System.Collections.Generic.KeyValuePair(Of String, String)) As Boolean Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).Contains
Return __dic.Contains(item)
End Function
Private Function IEnumerableGetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
Return __dic.GetEnumerator()
End Function
End Class