OSDN Git Service

同一のキー・カテゴリの場合追加できないように修正
[gikonavigoeson/gikonavi.git] / InputAssistDataModule.pas
index b073d3e..eb89a0b 100644 (file)
@@ -37,6 +37,8 @@ type
        function GetCategoryResistWords(Key: String; var list: TStringList): Integer;
        //! \93o\98^\8dÏ\82Ý\83L\81[\82Ì\91S\82Ä\82Ì\83J\83e\83S\83\8a\83\8a\83X\83g\8eæ\93¾
        procedure GetCategoryList(var list: TStringList);
+       //! \8aù\82É\93o\98^\8dÏ\82Ý\82Ì\83L\81[\82Æ\83J\83e\83S\83\8a\82Ì\83Z\83b\83g\82©\82Ç\82¤\82©\83`\83F\83b\83N
+       function IsDupulicate(Key: String; Category: String): Boolean;
 
   end;
 
@@ -409,5 +411,24 @@ begin
        except
        end;
 end;
+//! \8aù\82É\93o\98^\8dÏ\82Ý\82Ì\83L\81[\82Æ\83J\83e\83S\83\8a\82Ì\83Z\83b\83g\82©\82Ç\82¤\82©\83`\83F\83b\83N
+function TInputAssistDM.IsDupulicate(Key: String; Category: String): Boolean;
+var
+       i : Integer;
+       resWord : TResistWord;
+begin
+       // \82±\82Ì\83\81\83\\83b\83h\82Å\82Í\81A\83\\81[\83g\8dÏ\82Ý\82Æ\82Í\8cÀ\82ç\82È\82¢\82Ì\82Å\81A\91S\82Ä\82Ì\83L\81[\82ð\92T\8dõ\82µ\82Ä\82¢\82é
+       Result := False;
+       if (FDictionary <> nil) then begin
+               for i := 0 to FDictionary.Count - 1 do begin
+                       if (Key = FDictionary.Strings[i]) and
+                               (Category = TResistWord(FDictionary.Objects[i]).GetCategory)
+                       then begin
+                               Result := True;
+                               Break;
+                       end;
+               end;
+       end;
+end;
 
 end.