Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

suggest.h

Go to the documentation of this file.
00001 /*
00002   For general Scribus (>=1.3.2) copyright and licensing information
00003   please refer to the COPYING file provided with the
00004   program. Following this notice may exist a copyright and/or license
00005   notice that predates the release of Scribus 1.3.2 for which a new
00006   license (GPL+exception) is in place.
00007 */
00008 #ifndef SUGGEST_H
00009 #define SUGGEST_H
00010 
00011 // ISO C++ include files
00012 #include <sstream>            // For formatting aspell dictionary entries
00013 #include <stdexcept>          // For exceptions
00014 #include <string>             // Used in function arguments, errors 
00015 #include <vector>             // Used in function arguments
00016 #include <iostream>           // Printing to std::cout
00017 // aspell include files
00018 #include <aspell.h>
00019 
00023 namespace Speller {
00024   namespace Aspell {
00031     class Suggest {
00032     private:
00034         AspellConfig*  fconfig;
00036         AspellSpeller* fspeller;
00038             std::string    flang;
00040             std::string    fjargon;
00042         std::string    fencoding;
00043 
00052         void checkError() throw( std::runtime_error );
00061         void checkConfigError() throw( std::runtime_error );
00073         void init(const std::string& lang, const std::string& jargon,
00074             const std::string& encoding)
00075             throw( std::invalid_argument, std::runtime_error );
00085         void printWordList(const AspellWordList* wlist,
00086                    char delim='\n') throw(std::invalid_argument);
00095         void setConfig() throw( std::invalid_argument );
00105         void storeWordList(const AspellWordList* wlist,
00106                    std::vector<std::string>& replacement)
00107             throw( std::invalid_argument );
00108 
00109     public:
00113         static const char* kDICT_DELIM;
00117         static const char* kEMPTY;
00119         static const char* kDEF_LANG;
00121         static const char* kDEF_JARGON;
00123         static const char* kDEF_ENCODING;
00124 
00125         // Defaults are for standard aspell English dictionary. Use
00126         // "iso8859-1" for Basic Latin. See aspell lang.dat file for
00127         // actual encoding used for a given dictionary.
00139         Suggest(const std::string& lang=kDEF_LANG,
00140             const std::string& jargon=kDEF_JARGON,
00141             const std::string& encoding=kDEF_ENCODING)
00142             throw( std::invalid_argument, std::runtime_error );
00153         Suggest(const AspellDictInfo* dinfo,
00154             const std::string& encoding=kDEF_ENCODING)
00155             throw( std::invalid_argument, std::runtime_error );
00164         void addPersonalList(const std::string& word)
00165             throw( std::runtime_error );
00173         bool checkWord(const std::string& word);
00182         bool checkWord(const std::string& word,
00183                std::vector<std::string>& replacement,
00184                bool always=true) throw( std::invalid_argument );
00193         void clearSessionList() throw( std::runtime_error );
00201         std::string getConfigOpt(const std::string& opt);
00210         void getConfigOpt(const std::string& opt,
00211                   std::vector<std::string>& vals);
00220         void ignoreWord(const std::string& word)
00221             throw( std::runtime_error );
00229         void listDicts(std::vector<AspellDictInfo>& vals);
00237         void listDicts(std::vector<std::string>& vals);
00246         void printMainList() throw( std::invalid_argument );
00255         void printPersonalList() throw( std::invalid_argument );
00264         void printSessionList() throw( std::invalid_argument );
00274         bool printSuggestions(const std::string& word, bool always=true)
00275             throw( std::invalid_argument );
00285         void resetConfig()
00286             throw( std::invalid_argument, std::runtime_error );
00298         void resetConfig(const std::string& lang,
00299                  const std::string& jargon,
00300                  const std::string& encoding=kDEF_ENCODING)
00301             throw( std::invalid_argument, std::runtime_error );
00310         void saveLists() throw( std::runtime_error );
00320         void setConfigOpt(const std::string& opt, const std::string& val)
00321             throw( std::invalid_argument );
00330         void StoreMainList(std::vector<std::string>& replacement)
00331             throw( std::invalid_argument );
00340         void StorePersonalList(std::vector<std::string>& replacement)
00341             throw( std::invalid_argument );
00350         void StoreSessionList(std::vector<std::string>& replacement)
00351             throw( std::invalid_argument );
00352     };  // class Suggest
00353   }  // namespace Aspell
00354 }  // namespace Speller
00355 #endif  // #ifndef SUGGEST_H
00356 //@@@@@@@@@@@@@@@@@@@@@@@@@ END OF FILE @@@@@@@@@@@@@@@@@@@@@@@@@
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.