Speller::Aspell::Suggest Class Reference
Class for interfacing with aspell. Should work with any aspell version from 0.60 onwards. More...
#include <suggest.h>
Public Member Functions | |
| Suggest (const std::string &lang=kDEF_LANG, const std::string &jargon=kDEF_JARGON, const std::string &encoding=kDEF_ENCODING) throw ( std::invalid_argument, std::runtime_error ) | |
| Suggest (const AspellDictInfo *dinfo, const std::string &encoding=kDEF_ENCODING) throw ( std::invalid_argument, std::runtime_error ) | |
| void | addPersonalList (const std::string &word) throw ( std::runtime_error ) |
| bool | checkWord (const std::string &word) |
| bool | checkWord (const std::string &word, std::vector< std::string > &replacement, bool always=true) throw ( std::invalid_argument ) |
| void | clearSessionList () throw ( std::runtime_error ) |
| Clears the current session word list. | |
| std::string | getConfigOpt (const std::string &opt) |
| void | getConfigOpt (const std::string &opt, std::vector< std::string > &vals) |
| void | ignoreWord (const std::string &word) throw ( std::runtime_error ) |
| void | listDicts (std::vector< AspellDictInfo > &vals) |
| void | listDicts (std::vector< std::string > &vals) |
| void | printMainList () throw ( std::invalid_argument ) |
| Prints main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. | |
| void | printPersonalList () throw ( std::invalid_argument ) |
| Prints personal word list. | |
| void | printSessionList () throw ( std::invalid_argument ) |
| Prints session word list. | |
| bool | printSuggestions (const std::string &word, bool always=true) throw ( std::invalid_argument ) |
| void | resetConfig () throw ( std::invalid_argument, std::runtime_error ) |
| Resets aspell configuration, as per current set of parameters. | |
| void | resetConfig (const std::string &lang, const std::string &jargon, const std::string &encoding=kDEF_ENCODING) throw ( std::invalid_argument, std::runtime_error ) |
| void | saveLists () throw ( std::runtime_error ) |
| Saves all word lists. | |
| void | setConfigOpt (const std::string &opt, const std::string &val) throw ( std::invalid_argument ) |
| void | StoreMainList (std::vector< std::string > &replacement) throw ( std::invalid_argument ) |
| void | StorePersonalList (std::vector< std::string > &replacement) throw ( std::invalid_argument ) |
| void | StoreSessionList (std::vector< std::string > &replacement) throw ( std::invalid_argument ) |
Static Public Attributes | |
| static const char * | kDICT_DELIM = "/" |
| Delimiter between different components of formatted strings for aspell dictionary entries. | |
| static const char * | kEMPTY = "*" |
| Used in place of an empty string for an aspell setting (currently, only jargon might be empty). | |
| static const char * | kDEF_LANG = "en" |
| Default language for aspell dictionary. | |
| static const char * | kDEF_JARGON = "" |
| Default jargon for aspell dictionary. | |
| static const char * | kDEF_ENCODING = "utf-8" |
| Default character encoding for words. | |
Private Member Functions | |
| void | checkError () throw ( std::runtime_error ) |
| Checks aspell speller for an error condition. | |
| void | checkConfigError () throw ( std::runtime_error ) |
| Checks for aspell configuration error. | |
| void | init (const std::string &lang, const std::string &jargon, const std::string &encoding) throw ( std::invalid_argument, std::runtime_error ) |
| void | printWordList (const AspellWordList *wlist, char delim='\n') throw (std::invalid_argument) |
| void | setConfig () throw ( std::invalid_argument ) |
| Sets aspell speller configuration, as per current set of parameters. | |
| void | storeWordList (const AspellWordList *wlist, std::vector< std::string > &replacement) throw ( std::invalid_argument ) |
Private Attributes | |
| AspellConfig * | fconfig |
| Aspell configuration object. | |
| AspellSpeller * | fspeller |
| Aspell speller object. | |
| std::string | flang |
| Language for aspell dictionary. | |
| std::string | fjargon |
| Jargon for aspell dictionary. | |
| std::string | fencoding |
| Character encoding for words. | |
Detailed Description
Class for interfacing with aspell. Should work with any aspell version from 0.60 onwards.
Definition at line 31 of file suggest.h.
Constructor & Destructor Documentation
| Speller::Aspell::Suggest::Suggest | ( | const std::string & | lang = kDEF_LANG, |
|
| const std::string & | jargon = kDEF_JARGON, |
|||
| const std::string & | encoding = kDEF_ENCODING | |||
| ) | throw ( std::invalid_argument, std::runtime_error ) |
| Speller::Aspell::Suggest::Suggest | ( | const AspellDictInfo * | dinfo, | |
| const std::string & | encoding = kDEF_ENCODING | |||
| ) | throw ( std::invalid_argument, std::runtime_error ) |
Member Function Documentation
| Speller::Aspell::Suggest::checkError | ( | ) | throw ( std::runtime_error ) [private] |
Checks aspell speller for an error condition.
- Parameters:
-
None
- Return values:
-
None
- Exceptions:
-
std::runtime_error if an error condition exists.
Definition at line 18 of file suggest.cpp.
References fspeller.
Referenced by addPersonalList(), clearSessionList(), ignoreWord(), and saveLists().
| Speller::Aspell::Suggest::checkConfigError | ( | ) | throw ( std::runtime_error ) [private] |
Checks for aspell configuration error.
- Parameters:
-
None
- Return values:
-
None
- Exceptions:
-
std::runtime_error if an error condition exists
Definition at line 30 of file suggest.cpp.
References fconfig.
Referenced by setConfigOpt().
| void Speller::Aspell::Suggest::init | ( | const std::string & | lang, | |
| const std::string & | jargon, | |||
| const std::string & | encoding | |||
| ) | throw ( std::invalid_argument, std::runtime_error ) [private] |
Definition at line 43 of file suggest.cpp.
References fconfig, fencoding, fjargon, flang, fspeller, and setConfig().
Referenced by Suggest().
| void Speller::Aspell::Suggest::printWordList | ( | const AspellWordList * | wlist, | |
| char | delim = '\n' | |||
| ) | throw (std::invalid_argument) [private] |
Definition at line 109 of file suggest.cpp.
Referenced by printMainList(), printPersonalList(), printSessionList(), and printSuggestions().
| Speller::Aspell::Suggest::setConfig | ( | ) | throw ( std::invalid_argument ) [private] |
Sets aspell speller configuration, as per current set of parameters.
- Parameters:
-
None
- Return values:
-
None
- Exceptions:
-
std::invalid_argument from setConfigOpt()
Definition at line 130 of file suggest.cpp.
References fencoding, fjargon, flang, and setConfigOpt().
Referenced by init(), and resetConfig().
| void Speller::Aspell::Suggest::storeWordList | ( | const AspellWordList * | wlist, | |
| std::vector< std::string > & | replacement | |||
| ) | throw ( std::invalid_argument ) [private] |
Definition at line 145 of file suggest.cpp.
Referenced by checkWord(), StoreMainList(), StorePersonalList(), and StoreSessionList().
| void Speller::Aspell::Suggest::addPersonalList | ( | const std::string & | word | ) | throw ( std::runtime_error ) |
Definition at line 204 of file suggest.cpp.
References checkError(), fspeller, and word().
Referenced by AspellPluginImpl::on_faddWordBtn_clicked().
| bool Speller::Aspell::Suggest::checkWord | ( | const std::string & | word | ) |
Definition at line 223 of file suggest.cpp.
References fspeller.
Referenced by AspellPluginImpl::checkText(), checkWord(), and printSuggestions().
| bool Speller::Aspell::Suggest::checkWord | ( | const std::string & | word, | |
| std::vector< std::string > & | replacement, | |||
| bool | always = true | |||
| ) | throw ( std::invalid_argument ) |
Definition at line 234 of file suggest.cpp.
References checkWord(), fspeller, storeWordList(), and word().
| Speller::Aspell::Suggest::clearSessionList | ( | ) | throw ( std::runtime_error ) |
Clears the current session word list.
- Parameters:
-
None
- Return values:
-
None
- Exceptions:
-
std::runtime_error for error in clearing list.
Definition at line 280 of file suggest.cpp.
References checkError(), and fspeller.
| std::string Speller::Aspell::Suggest::getConfigOpt | ( | const std::string & | opt | ) |
| void Speller::Aspell::Suggest::getConfigOpt | ( | const std::string & | opt, | |
| std::vector< std::string > & | vals | |||
| ) |
| void Speller::Aspell::Suggest::ignoreWord | ( | const std::string & | word | ) | throw ( std::runtime_error ) |
Definition at line 318 of file suggest.cpp.
References checkError(), fspeller, and word().
Referenced by AspellPluginImpl::on_fskipAllBtn_clicked().
| void Speller::Aspell::Suggest::listDicts | ( | std::vector< AspellDictInfo > & | vals | ) |
Definition at line 78 of file suggest.cpp.
References fconfig.
Referenced by AspellPluginImpl::AspellPluginImpl(), and listDicts().
| void Speller::Aspell::Suggest::listDicts | ( | std::vector< std::string > & | vals | ) |
| Speller::Aspell::Suggest::printMainList | ( | ) | throw ( std::invalid_argument ) |
Prints main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3.
- Parameters:
-
None
- Return values:
-
None.
- Exceptions:
-
std::invalid_argument from printWordList().
Definition at line 334 of file suggest.cpp.
References fspeller, and printWordList().
| Speller::Aspell::Suggest::printPersonalList | ( | ) | throw ( std::invalid_argument ) |
Prints personal word list.
- Parameters:
-
None
- Return values:
-
None.
- Exceptions:
-
std::invalid_argument from printWordList().
Definition at line 348 of file suggest.cpp.
References fspeller, and printWordList().
| Speller::Aspell::Suggest::printSessionList | ( | ) | throw ( std::invalid_argument ) |
Prints session word list.
- Parameters:
-
None
- Return values:
-
None.
- Exceptions:
-
std::invalid_argument from printWordList().
Definition at line 363 of file suggest.cpp.
References fspeller, and printWordList().
| bool Speller::Aspell::Suggest::printSuggestions | ( | const std::string & | word, | |
| bool | always = true | |||
| ) | throw ( std::invalid_argument ) |
Definition at line 378 of file suggest.cpp.
References checkWord(), fspeller, printWordList(), and word().
| Speller::Aspell::Suggest::resetConfig | ( | ) | throw ( std::invalid_argument, std::runtime_error ) |
Resets aspell configuration, as per current set of parameters.
Resets aspell configuration, as per current set of parameters, after resetting lang, jargon, and encoding.
- Parameters:
-
None
- Return values:
-
None
- Exceptions:
-
std::invalid_argument from setConfig(). std::runtime_error for error in recreating speller.
- Parameters:
-
lang,: Language of aspell dictionary. jargon,: Jargon for aspell dictionary. encoding,: Character encoding for words.
- Return values:
-
None
- Exceptions:
-
std::invalid_argument from setConfig(). std::runtime_error for error in recreating speller.
Definition at line 422 of file suggest.cpp.
References fconfig, fspeller, and setConfig().
Referenced by AspellPluginImpl::on_flistDicts_activated(), and resetConfig().
| void Speller::Aspell::Suggest::resetConfig | ( | const std::string & | lang, | |
| const std::string & | jargon, | |||
| const std::string & | encoding = kDEF_ENCODING | |||
| ) | throw ( std::invalid_argument, std::runtime_error ) |
Definition at line 454 of file suggest.cpp.
References fencoding, fjargon, flang, and resetConfig().
| Speller::Aspell::Suggest::saveLists | ( | ) | throw ( std::runtime_error ) |
Saves all word lists.
- Parameters:
-
None
- Return values:
-
None
- Exceptions:
-
std::runtime_error for error in saving lists.
Definition at line 478 of file suggest.cpp.
References checkError(), and fspeller.
Referenced by AspellPluginImpl::~AspellPluginImpl().
| void Speller::Aspell::Suggest::setConfigOpt | ( | const std::string & | opt, | |
| const std::string & | val | |||
| ) | throw ( std::invalid_argument ) |
Definition at line 492 of file suggest.cpp.
References checkConfigError(), and fconfig.
Referenced by setConfig().
| void Speller::Aspell::Suggest::StoreMainList | ( | std::vector< std::string > & | replacement | ) | throw ( std::invalid_argument ) |
| void Speller::Aspell::Suggest::StorePersonalList | ( | std::vector< std::string > & | replacement | ) | throw ( std::invalid_argument ) |
| void Speller::Aspell::Suggest::StoreSessionList | ( | std::vector< std::string > & | replacement | ) | throw ( std::invalid_argument ) |
Member Data Documentation
AspellConfig* Speller::Aspell::Suggest::fconfig [private] |
Aspell configuration object.
Definition at line 34 of file suggest.h.
Referenced by checkConfigError(), getConfigOpt(), init(), listDicts(), resetConfig(), and setConfigOpt().
AspellSpeller* Speller::Aspell::Suggest::fspeller [private] |
Aspell speller object.
Definition at line 36 of file suggest.h.
Referenced by addPersonalList(), checkError(), checkWord(), clearSessionList(), ignoreWord(), init(), printMainList(), printPersonalList(), printSessionList(), printSuggestions(), resetConfig(), saveLists(), StoreMainList(), StorePersonalList(), and StoreSessionList().
std::string Speller::Aspell::Suggest::flang [private] |
Language for aspell dictionary.
Definition at line 38 of file suggest.h.
Referenced by init(), resetConfig(), and setConfig().
std::string Speller::Aspell::Suggest::fjargon [private] |
Jargon for aspell dictionary.
Definition at line 40 of file suggest.h.
Referenced by init(), resetConfig(), and setConfig().
std::string Speller::Aspell::Suggest::fencoding [private] |
Character encoding for words.
Definition at line 42 of file suggest.h.
Referenced by init(), resetConfig(), and setConfig().
const char * Speller::Aspell::Suggest::kDICT_DELIM = "/" [static] |
Delimiter between different components of formatted strings for aspell dictionary entries.
Definition at line 113 of file suggest.h.
Referenced by listDicts(), and AspellPluginImpl::on_flistDicts_activated().
const char * Speller::Aspell::Suggest::kEMPTY = "*" [static] |
Used in place of an empty string for an aspell setting (currently, only jargon might be empty).
Definition at line 117 of file suggest.h.
Referenced by listDicts(), and AspellPluginImpl::setPreferences().
const char * Speller::Aspell::Suggest::kDEF_LANG = "en" [static] |
Default language for aspell dictionary.
Definition at line 119 of file suggest.h.
Referenced by AspellPluginImpl::getPreferences().
const char * Speller::Aspell::Suggest::kDEF_JARGON = "" [static] |
Default jargon for aspell dictionary.
Definition at line 121 of file suggest.h.
Referenced by AspellPluginImpl::getPreferences().
const char * Speller::Aspell::Suggest::kDEF_ENCODING = "utf-8" [static] |
Default character encoding for words.
Definition at line 123 of file suggest.h.
Referenced by AspellPluginImpl::getPreferences(), and AspellPluginImpl::on_flistDicts_activated().
The documentation for this class was generated from the following files:
