diff options
author | Vlad Voicu <vladvoic@gmail.com> | 2011-11-29 02:41:07 (GMT) |
---|---|---|
committer | vlad <vlad@tyrion.(none)> | 2012-10-13 13:55:44 (GMT) |
commit | 0a13558efc0ccf0e5afceb63c416d8cb401997ec (patch) | |
tree | 0fe17d78ecced7389b7f2a3d121b223bbce8dc26 /SwifTools/SpellCheckerFactory.cpp | |
parent | 5e7be9a49cf540a68275f084e57a6efe8d7c1626 (diff) | |
download | swift-contrib-0a13558efc0ccf0e5afceb63c416d8cb401997ec.zip swift-contrib-0a13558efc0ccf0e5afceb63c416d8cb401997ec.tar.bz2 |
Added Factory for creeating SpellCheckers
Diffstat (limited to 'SwifTools/SpellCheckerFactory.cpp')
-rw-r--r-- | SwifTools/SpellCheckerFactory.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/SwifTools/SpellCheckerFactory.cpp b/SwifTools/SpellCheckerFactory.cpp new file mode 100644 index 0000000..46c8f65 --- /dev/null +++ b/SwifTools/SpellCheckerFactory.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2011 Voicu Vlad + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <SwifTools/SpellChecker.h> +#include <SwifTools/HunspellChecker.h> +#include <SwifTools/SpellCheckerFactory.h> + +#ifdef HAVE_HUNSPELL +#include <hunspell/hunspell.hxx> +#else +#define HAVE_NO_SPELL_CHECK +#endif + +namespace Swift { + +SpellCheckerFactory::SpellCheckerFactory() { +} + +SpellChecker* SpellCheckerFactory::createSpellChecker() { +#ifdef HAVE_HUNSPELL + //TODO(vladv): Do something smart about finding available dictionaries, + // maybe a UI button to select language from available dictionaries? + const char* dictPath = "/usr/share/hunspell/en_US.dic"; + const char* affixPath = "/usr/share/hunspell/en_US.aff"; + return new HunspellChecker(affixPath, dictPath); +#endif +} + +} |