TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dictionary.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*-
  2. /*
  3. * dictionary.h
  4. *
  5. * Copyright (C) 2004 Zack Rusin <zack@kde.org>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. */
  22. #ifndef TDESPELL_DICTIONARY_H
  23. #define TDESPELL_DICTIONARY_H
  24. #include <tqstringlist.h>
  25. #include <tqstring.h>
  26. namespace KSpell2
  27. {
  28. /**
  29. * Class is returned by from Broker. It acts
  30. * as the actual spellchecker.
  31. *
  32. * @author Zack Rusin <zack@kde.org>
  33. * @short class used for actuall spell checking
  34. */
  35. class Dictionary
  36. {
  37. public:
  38. virtual ~Dictionary() {}
  39. /**
  40. * Checks the given word.
  41. * @return false if the word is misspelled. true otherwise
  42. */
  43. virtual bool check( const TQString& word ) =0;
  44. /**
  45. * Fetches suggestions for the word.
  46. *
  47. * @return list of all suggestions for the word
  48. */
  49. virtual TQStringList suggest( const TQString& word ) =0;
  50. /**
  51. * Checks the word and fetches suggestions for it.
  52. */
  53. virtual bool checkAndSuggest( const TQString& word,
  54. TQStringList& suggestions ) =0;
  55. /**
  56. * Stores user defined good replacement for the bad word.
  57. * @returns true on success
  58. */
  59. virtual bool storeReplacement( const TQString& bad,
  60. const TQString& good ) =0;
  61. /**
  62. * Adds word to the list of of personal words.
  63. * @return true on success
  64. */
  65. virtual bool addToPersonal( const TQString& word ) =0;
  66. /**
  67. * Adds word to the words recognizable in the current session.
  68. * @return true on success
  69. */
  70. virtual bool addToSession( const TQString& word ) =0;
  71. /**
  72. * Returns language supported by this dictionary.
  73. */
  74. TQString language() const
  75. {
  76. return m_language;
  77. }
  78. /**
  79. * Returns true if this dictionary was constructed from
  80. * default Settings values
  81. */
  82. bool isDefault() const
  83. {
  84. return m_default;
  85. }
  86. protected:
  87. Dictionary( const TQString& lang, bool def = false )
  88. : m_language( lang ), m_default( def ) {}
  89. protected:
  90. friend class Broker;
  91. TQString m_language;
  92. bool m_default;
  93. private:
  94. class Private;
  95. Private *d;
  96. };
  97. }
  98. #endif