diff --git a/mff/Dictionary.bas b/mff/Dictionary.bas index 4c69cbb8..bbd508eb 100644 --- a/mff/Dictionary.bas +++ b/mff/Dictionary.bas @@ -217,10 +217,18 @@ Private Function Dictionary.IndexOf(ByRef wText As WString) As Integer Return -1 End Function -Private Function Dictionary.IndexOfKey(ByRef Key As WString) As Integer - For i As Integer = 0 To Count - 1 - If QDictionaryItem(FItems.Items[i]).Key = Key Then Return i - Next i +Private Function Dictionary.IndexOfKey(ByRef Key As WString, Object As Any Ptr = 0) As Integer + If Object = 0 Then + For i As Integer = 0 To Count - 1 + If QDictionaryItem(FItems.Items[i]).Key = Key Then Return i + Next i + Else + For i As Integer = 0 To Count - 1 + With QDictionaryItem(FItems.Items[i]) + If .Key = Key AndAlso .Object = Object Then Return i + End With + Next i + End If Return -1 End Function @@ -301,8 +309,8 @@ Private Function Dictionary.Contains(ByRef wText As WString) As Boolean Return IndexOf(wText) <> -1 End Function -Private Function Dictionary.ContainsKey(ByRef Key As WString) As Boolean - Return IndexOfKey(Key) <> -1 +Private Function Dictionary.ContainsKey(ByRef Key As WString, Object As Any Ptr = 0) As Boolean + Return IndexOfKey(Key, Object) <> -1 End Function Private Function Dictionary.ContainsObject(Object As Any Ptr) As Boolean diff --git a/mff/Dictionary.bi b/mff/Dictionary.bi index 39eee120..071f7eba 100644 --- a/mff/Dictionary.bi +++ b/mff/Dictionary.bi @@ -55,7 +55,7 @@ Public: Declare Sub SortKeys Declare Sub Clear Declare Function IndexOf(ByRef wText As WString) As Integer - Declare Function IndexOfKey(ByRef Key As WString) As Integer + Declare Function IndexOfKey(ByRef Key As WString, Object As Any Ptr = 0) As Integer Declare Function IndexOfObject(FObj As Any Ptr) As Integer Declare Sub Set(ByRef Key As WString, ByRef wText As WString = "", Object As Any Ptr = 0) Declare Function Get(Index As Integer, ByRef DefaultText As WString = "") ByRef As WString @@ -65,7 +65,7 @@ Public: Declare Function GetText(ByRef Key As WString) ByRef As WString Declare Function GetObject(ByRef Key As WString) As Any Ptr Declare Function Contains(ByRef wText As WString) As Boolean - Declare Function ContainsKey(ByRef Key As WString) As Boolean + Declare Function ContainsKey(ByRef Key As WString, Object As Any Ptr = 0) As Boolean Declare Function ContainsObject(Object As Any Ptr) As Boolean Declare Sub SaveToFile(ByRef FileName As WString) Declare Sub LoadFromFile(ByRef FileName As WString)