summaryrefslogtreecommitdiffstats
blob: 46c8f658b79ea9191cc119f8ef3c07cb2f4cfeea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
}

}