summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlad Voicu <vladv@rosedu.org>2012-03-08 13:10:15 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-03-09 15:04:11 (GMT)
commit02f7f0d98e937d8ec2d527ac701daf783bb37f27 (patch)
tree90555f4fd78725042cddb0abac32fca403a94be9 /SwifTools
parentdbc27f2f163c33366fc9ca31088f0c255963168b (diff)
downloadswift-contrib-02f7f0d98e937d8ec2d527ac701daf783bb37f27.zip
swift-contrib-02f7f0d98e937d8ec2d527ac701daf783bb37f27.tar.bz2
Gracefully degrade when hunspell is not present
Diffstat (limited to 'SwifTools')
-rw-r--r--SwifTools/HunspellChecker.cpp3
-rw-r--r--SwifTools/SpellCheckerFactory.h4
2 files changed, 6 insertions, 1 deletions
diff --git a/SwifTools/HunspellChecker.cpp b/SwifTools/HunspellChecker.cpp
index 6c1b4bb..fa5917a 100644
--- a/SwifTools/HunspellChecker.cpp
+++ b/SwifTools/HunspellChecker.cpp
@@ -43,7 +43,8 @@ void HunspellChecker::checkFragment(const std::string& fragment, PositionPairLis
for (PositionPairList::iterator it = misspelledPositions.begin(); it != misspelledPositions.end();) {
if (isCorrect(fragment.substr(boost::get<0>(*it), boost::get<1>(*it) - boost::get<0>(*it)))) {
misspelledPositions.erase(it++);
- } else {
+ }
+ else {
++it;
}
}
diff --git a/SwifTools/SpellCheckerFactory.h b/SwifTools/SpellCheckerFactory.h
index d58a9ec..5519db5 100644
--- a/SwifTools/SpellCheckerFactory.h
+++ b/SwifTools/SpellCheckerFactory.h
@@ -6,6 +6,10 @@
#pragma once
+#ifdef HAVE_HUNSPELL
+#define HAVE_SPELLCHECKER
+#endif
+
namespace Swift {
class SpellChecker;
class SpellCheckerFactory {