2008-03-07 03:32:29 +01:00
|
|
|
// Copyright (c) 2008, Rodrigo Braz Monteiro
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2008-03-07 03:32:29 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file spellchecker_hunspell.h
|
|
|
|
/// @see spellchecker_hunspell.cpp
|
|
|
|
/// @ingroup spelling
|
|
|
|
///
|
2008-03-07 03:32:29 +01:00
|
|
|
|
|
|
|
#ifdef WITH_HUNSPELL
|
|
|
|
|
2010-11-29 11:17:12 +01:00
|
|
|
#include <memory>
|
2008-03-07 03:32:29 +01:00
|
|
|
#include <hunspell/hunspell.hxx>
|
|
|
|
|
2009-09-11 04:36:34 +02:00
|
|
|
#include "include/aegisub/spellchecker.h"
|
2010-06-03 22:32:25 +02:00
|
|
|
namespace agi {
|
|
|
|
namespace charset {
|
|
|
|
class IconvWrapper;
|
|
|
|
}
|
|
|
|
}
|
2008-03-07 03:32:29 +01:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @class HunspellSpellChecker
|
2009-08-01 06:37:29 +02:00
|
|
|
/// @brief Hunspell spell checker
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
///
|
2008-03-07 03:32:29 +01:00
|
|
|
class HunspellSpellChecker : public SpellChecker {
|
2009-08-01 06:37:29 +02:00
|
|
|
/// Hunspell instance
|
2010-11-17 06:43:56 +01:00
|
|
|
std::auto_ptr<Hunspell> hunspell;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-11-18 04:00:08 +01:00
|
|
|
/// Conversions between the dictionary charset and utf-8
|
2010-11-17 06:43:56 +01:00
|
|
|
std::auto_ptr<agi::charset::IconvWrapper> conv;
|
|
|
|
std::auto_ptr<agi::charset::IconvWrapper> rconv;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-11-18 04:00:08 +01:00
|
|
|
/// Languages which we have dictionaries for
|
|
|
|
wxArrayString languages;
|
|
|
|
|
2009-08-01 06:37:29 +02:00
|
|
|
/// Path to user-local dictionary.
|
2010-11-17 06:43:56 +01:00
|
|
|
wxString userDicPath;
|
2008-03-07 03:32:29 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
HunspellSpellChecker();
|
|
|
|
~HunspellSpellChecker();
|
|
|
|
|
2010-11-17 06:43:56 +01:00
|
|
|
/// @brief Add word to dictionary
|
|
|
|
/// @param word Word to add.
|
2008-03-07 03:32:29 +01:00
|
|
|
void AddWord(wxString word);
|
2010-11-17 06:43:56 +01:00
|
|
|
|
|
|
|
/// @brief Can add to dictionary?
|
|
|
|
/// @param word Word to check.
|
|
|
|
/// @return Whether word can be added or not.
|
2008-03-07 03:32:29 +01:00
|
|
|
bool CanAddWord(wxString word);
|
|
|
|
|
2010-11-17 06:43:56 +01:00
|
|
|
/// @brief Check if the word is valid.
|
|
|
|
/// @param word Word to check
|
|
|
|
/// @return Whether word is valid or not.
|
2008-03-07 03:32:29 +01:00
|
|
|
bool CheckWord(wxString word);
|
2010-11-17 06:43:56 +01:00
|
|
|
|
|
|
|
/// @brief Get suggestions for word.
|
|
|
|
/// @param word Word to get suggestions for
|
|
|
|
/// @return List of suggestions
|
2008-03-07 03:32:29 +01:00
|
|
|
wxArrayString GetSuggestions(wxString word);
|
|
|
|
|
2010-11-17 06:43:56 +01:00
|
|
|
/// @brief Get a list of languages which dictionaries are present for
|
2008-03-07 03:32:29 +01:00
|
|
|
wxArrayString GetLanguageList();
|
2010-11-17 06:43:56 +01:00
|
|
|
/// @brief Set the spellchecker's language
|
|
|
|
/// @param language Language code
|
2008-03-07 03:32:29 +01:00
|
|
|
void SetLanguage(wxString language);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|