TextCheckerEnchant.h [plain text]
#ifndef TextCheckerEnchant_h
#define TextCheckerEnchant_h
#if ENABLE(SPELLCHECK)
#include <enchant.h>
#include <wtf/FastMalloc.h>
#include <wtf/Vector.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class TextCheckerEnchant {
WTF_MAKE_FAST_ALLOCATED;
public:
TextCheckerEnchant();
virtual ~TextCheckerEnchant();
void ignoreWord(const String&);
void learnWord(const String&);
void checkSpellingOfString(const String&, int& misspellingLocation, int& misspellingLength);
Vector<String> getGuessesForWord(const String&);
void updateSpellCheckingLanguages(const Vector<String>& languages);
Vector<String> loadedSpellCheckingLanguages() const;
bool hasDictionary() const { return !m_enchantDictionaries.isEmpty(); }
Vector<String> availableSpellCheckingLanguages() const;
private:
void freeEnchantBrokerDictionaries();
void checkSpellingOfWord(const CString&, int start, int end, int& misspellingLocation, int& misspellingLength);
EnchantBroker* m_broker;
Vector<EnchantDict*> m_enchantDictionaries;
};
}
#endif // ENABLE(SPELLCHECK)
#endif