mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
Simple spelling checker using the Hunspell library.
This time adding the source files :) The checker is used (experimentally) by the magic game file. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1262 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||
//| Copyright: (C) 2001 - 2008 Twan van Laarhoven and "coppro" |
|
||||
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
#ifndef HEADER_UTIL_SPELL_CHECKER
|
||||
#define HEADER_UTIL_SPELL_CHECKER
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include "hunspell.hxx"
|
||||
|
||||
DECLARE_POINTER_TYPE(SpellChecker);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Spell checker
|
||||
|
||||
/// A spelling checker for a particular language
|
||||
class SpellChecker : public Hunspell, public IntrusivePtrBase<SpellChecker> {
|
||||
public:
|
||||
/// Get a SpellChecker object for the given language.
|
||||
/** Note: This is not threadsafe yet */
|
||||
static SpellChecker& get(const String& language);
|
||||
/// Destroy all cached SpellChecker objects
|
||||
static void destroy();
|
||||
|
||||
/// Check the spelling of a single word
|
||||
bool spell(const String& word);
|
||||
/// Check the spelling of a single word, ignore punctuation
|
||||
bool spell_with_punctuation(const String& word);
|
||||
|
||||
private:
|
||||
/// Convert between String and dictionary encoding
|
||||
wxCSConv encoding;
|
||||
|
||||
SpellChecker(const char* aff_path, const char* dic_path);
|
||||
static map<String,SpellCheckerP> spellers; //< Cached checkers for each language
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
Reference in New Issue
Block a user