|
Scribus
Open source desktop publishing at your fingertips
|
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 ) | |
| Default constructor for spell-checking class. More... | |
| Suggest (const AspellDictInfo *dinfo, const std::string &encoding=kDEF_ENCODING) throw ( std::invalid_argument, std::runtime_error ) | |
| Constructor for spell-checking class. More... | |
| void | addPersonalList (const std::string &word) throw ( std::runtime_error ) |
| Adds 'word' to personal list. More... | |
| bool | checkWord (const std::string &word) |
| Spell-checks 'word'. More... | |
| bool | checkWord (const std::string &word, std::vector< std::string > &replacement, bool always=true) throw ( std::invalid_argument ) |
| Spell-checks 'word'. More... | |
| void | clearSessionList () throw ( std::runtime_error ) |
| Clears the current session word list. More... | |
| std::string | getConfigOpt (const std::string &opt) |
| Gets value of configuration option, 'opt'. More... | |
| void | getConfigOpt (const std::string &opt, std::vector< std::string > &vals) |
| Gets value of list type configuration option, 'opt'. More... | |
| void | ignoreWord (const std::string &word) throw ( std::runtime_error ) |
| Ignores 'word' for current session. More... | |
| void | listDicts (std::vector< AspellDictInfo > &vals) |
| Obtains list of available aspell dictionaries. More... | |
| void | listDicts (std::vector< std::string > &vals) |
| Obtains list of available aspell dictionaries. More... | |
| 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. More... | |
| void | printPersonalList () throw ( std::invalid_argument ) |
| Prints personal word list. More... | |
| void | printSessionList () throw ( std::invalid_argument ) |
| Prints session word list. More... | |
| bool | printSuggestions (const std::string &word, bool always=true) throw ( std::invalid_argument ) |
| Spell-checks word, and prints suggested replacements. More... | |
| void | resetConfig () throw ( std::invalid_argument, std::runtime_error ) |
| Resets aspell configuration, as per current set of parameters. More... | |
| void | resetConfig (const std::string &lang, const std::string &jargon, const std::string &encoding=kDEF_ENCODING) throw ( std::invalid_argument, std::runtime_error ) |
| Resets aspell configuration, as per current set of parameters, after resetting lang, jargon, and encoding. More... | |
| void | saveLists () throw ( std::runtime_error ) |
| Saves all word lists. More... | |
| void | setConfigOpt (const std::string &opt, const std::string &val) throw ( std::invalid_argument ) |
| Sets configuration option, 'opt' to value 'val'. More... | |
| void | StoreMainList (std::vector< std::string > &replacement) throw ( std::invalid_argument ) |
| Stores main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. More... | |
| void | StorePersonalList (std::vector< std::string > &replacement) throw ( std::invalid_argument ) |
| Stores personal word list. More... | |
| void | StoreSessionList (std::vector< std::string > &replacement) throw ( std::invalid_argument ) |
| Stores session word list. More... | |
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. | |
Class for interfacing with aspell. Should work with any aspell version from 0.60 onwards.
| 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 | |||
| ) | |||
Default constructor for spell-checking class.
| lang | Language of aspell dictionary. |
| jargon | Jargon for aspell dictionary. |
| encoding | Character encoding for words. |
| None |
| std::invalid_argument | from setConfig(). |
| std::runtime_error | for error in creating speller. |
| Speller::Aspell::Suggest::Suggest | ( | const AspellDictInfo * | dinfo, |
| const std::string & | encoding = kDEF_ENCODING |
||
| ) | |||
| throw | ( | std::invalid_argument, | |
| std::runtime_error | |||
| ) | |||
Constructor for spell-checking class.
| dinfo | aspell dictionary info structure. |
| encoding | Character encoding of words. |
| None |
| std::invalid_argument | from setConfig(). |
| std::runtime_error | for error in creating speller. |
| void Speller::Aspell::Suggest::addPersonalList | ( | const std::string & | word | ) | |
| throw | ( | std::runtime_error | |||
| ) | |||||
Adds 'word' to personal list.
| word | Word to be added to personal list. |
| None |
| std::runtime_error | for error in adding word. |
| bool Speller::Aspell::Suggest::checkWord | ( | const std::string & | word | ) |
Spell-checks 'word'.
| word | Word to be checked. |
| true | if word is spelt correctly, else false |
| bool Speller::Aspell::Suggest::checkWord | ( | const std::string & | word, |
| std::vector< std::string > & | replacement, | ||
| bool | always = true |
||
| ) | |||
| throw | ( | std::invalid_argument | |
| ) | |||
Spell-checks 'word'.
| word | Word to be checked. |
| true | if word is spelt correctly, else false |
| std::invalid_argument | from storeWordList(). |
| void Speller::Aspell::Suggest::clearSessionList | ( | ) | ||
| throw | ( | std::runtime_error | ||
| ) | ||||
Clears the current session word list.
| None |
| None |
| std::runtime_error | for error in clearing list. |
| std::string Speller::Aspell::Suggest::getConfigOpt | ( | const std::string & | opt | ) |
Gets value of configuration option, 'opt'.
| opt | Name of option whose setting is to be retrieved. |
| Value | of option setting. |
| void Speller::Aspell::Suggest::getConfigOpt | ( | const std::string & | opt, |
| std::vector< std::string > & | vals | ||
| ) |
Gets value of list type configuration option, 'opt'.
| opt | Name of option whose setting is to be retrieved. |
| vals | Vector for storing values for the list type object. |
| None. |
| void Speller::Aspell::Suggest::ignoreWord | ( | const std::string & | word | ) | |
| throw | ( | std::runtime_error | |||
| ) | |||||
Ignores 'word' for current session.
| word | Word to be ignored. |
| None. |
| std::runtime_error | for error in ignoring word. |
| void Speller::Aspell::Suggest::listDicts | ( | std::vector< AspellDictInfo > & | vals | ) |
Obtains list of available aspell dictionaries.
| vals | Array of aspell dictionary info structs |
| None |
| void Speller::Aspell::Suggest::listDicts | ( | std::vector< std::string > & | vals | ) |
Obtains list of available aspell dictionaries.
| vals | Array of formatted strings for aspell dictionary entries. Each has format <name>–<lang>–<jargon>–<size> |
| None |
| void 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.
| None |
| None. |
| std::invalid_argument | from printWordList(). |
| void Speller::Aspell::Suggest::printPersonalList | ( | ) | ||
| throw | ( | std::invalid_argument | ||
| ) | ||||
Prints personal word list.
| None |
| None. |
| std::invalid_argument | from printWordList(). |
| void Speller::Aspell::Suggest::printSessionList | ( | ) | ||
| throw | ( | std::invalid_argument | ||
| ) | ||||
Prints session word list.
| None |
| None. |
| std::invalid_argument | from printWordList(). |
| bool Speller::Aspell::Suggest::printSuggestions | ( | const std::string & | word, |
| bool | always = true |
||
| ) | |||
| throw | ( | std::invalid_argument | |
| ) | |||
Spell-checks word, and prints suggested replacements.
| word | Word to be checked. |
| always | If true, replacements are always printed, else only if word is mis-spelt. |
| true | if word is spelt correctly, else false |
| std::invalid_argument | from printWordList(). |
| void Speller::Aspell::Suggest::resetConfig | ( | ) | ||
| throw | ( | std::invalid_argument, | ||
| std::runtime_error | ||||
| ) | ||||
Resets aspell configuration, as per current set of parameters.
| None |
| None |
| std::invalid_argument | from setConfig(). |
| std::runtime_error | for error in recreating speller. |
| 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 | |||
| ) | |||
Resets aspell configuration, as per current set of parameters, after resetting lang, jargon, and encoding.
| lang | Language of aspell dictionary. |
| jargon | Jargon for aspell dictionary. |
| encoding | Character encoding for words. |
| None |
| std::invalid_argument | from setConfig(). |
| std::runtime_error | for error in recreating speller. |
| void Speller::Aspell::Suggest::saveLists | ( | ) | ||
| throw | ( | std::runtime_error | ||
| ) | ||||
Saves all word lists.
| None |
| None |
| std::runtime_error | for error in saving lists. |
| void Speller::Aspell::Suggest::setConfigOpt | ( | const std::string & | opt, |
| const std::string & | val | ||
| ) | |||
| throw | ( | std::invalid_argument | |
| ) | |||
Sets configuration option, 'opt' to value 'val'.
| opt | Option to be set. |
| val | Value of option to be set. |
| None |
| std::invalid_argument | if option value is incorrect |
| void Speller::Aspell::Suggest::StoreMainList | ( | std::vector< std::string > & | replacement | ) | |
| throw | ( | std::invalid_argument | |||
| ) | |||||
Stores main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3.
| None |
| None. |
| std::invalid_argument | from storeWordList(). |
| void Speller::Aspell::Suggest::StorePersonalList | ( | std::vector< std::string > & | replacement | ) | |
| throw | ( | std::invalid_argument | |||
| ) | |||||
Stores personal word list.
| None |
| None. |
| std::invalid_argument | from storeWordList(). |
| void Speller::Aspell::Suggest::StoreSessionList | ( | std::vector< std::string > & | replacement | ) | |
| throw | ( | std::invalid_argument | |||
| ) | |||||
Stores session word list.
| None |
| None. |
| std::invalid_argument | from storeWordList(). |