extensions/spellcheck/hunspell/src/mozHunspell.h

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 /******* BEGIN LICENSE BLOCK *******
michael@0 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
michael@0 3 *
michael@0 4 * The contents of this file are subject to the Mozilla Public License Version
michael@0 5 * 1.1 (the "License"); you may not use this file except in compliance with
michael@0 6 * the License. You may obtain a copy of the License at
michael@0 7 * http://www.mozilla.org/MPL/
michael@0 8 *
michael@0 9 * Software distributed under the License is distributed on an "AS IS" basis,
michael@0 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
michael@0 11 * for the specific language governing rights and limitations under the
michael@0 12 * License.
michael@0 13 *
michael@0 14 * The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
michael@0 15 * and László Németh (Hunspell). Portions created by the Initial Developers
michael@0 16 * are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
michael@0 17 *
michael@0 18 * Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
michael@0 19 * David Einstein (deinst@world.std.com)
michael@0 20 * Michiel van Leeuwen (mvl@exedo.nl)
michael@0 21 * Caolan McNamara (cmc@openoffice.org)
michael@0 22 * László Németh (nemethl@gyorsposta.hu)
michael@0 23 * Davide Prina
michael@0 24 * Giuseppe Modugno
michael@0 25 * Gianluca Turconi
michael@0 26 * Simon Brouwer
michael@0 27 * Noll Janos
michael@0 28 * Biro Arpad
michael@0 29 * Goldman Eleonora
michael@0 30 * Sarlos Tamas
michael@0 31 * Bencsath Boldizsar
michael@0 32 * Halacsy Peter
michael@0 33 * Dvornik Laszlo
michael@0 34 * Gefferth Andras
michael@0 35 * Nagy Viktor
michael@0 36 * Varga Daniel
michael@0 37 * Chris Halls
michael@0 38 * Rene Engelhard
michael@0 39 * Bram Moolenaar
michael@0 40 * Dafydd Jones
michael@0 41 * Harri Pitkanen
michael@0 42 * Andras Timar
michael@0 43 * Tor Lillqvist
michael@0 44 * Jesper Kristensen (mail@jesperkristensen.dk)
michael@0 45 *
michael@0 46 * Alternatively, the contents of this file may be used under the terms of
michael@0 47 * either the GNU General Public License Version 2 or later (the "GPL"), or
michael@0 48 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
michael@0 49 * in which case the provisions of the GPL or the LGPL are applicable instead
michael@0 50 * of those above. If you wish to allow use of your version of this file only
michael@0 51 * under the terms of either the GPL or the LGPL, and not to allow others to
michael@0 52 * use your version of this file under the terms of the MPL, indicate your
michael@0 53 * decision by deleting the provisions above and replace them with the notice
michael@0 54 * and other provisions required by the GPL or the LGPL. If you do not delete
michael@0 55 * the provisions above, a recipient may use your version of this file under
michael@0 56 * the terms of any one of the MPL, the GPL or the LGPL.
michael@0 57 *
michael@0 58 ******* END LICENSE BLOCK *******/
michael@0 59
michael@0 60 #ifndef mozHunspell_h__
michael@0 61 #define mozHunspell_h__
michael@0 62
michael@0 63 #include <hunspell.hxx>
michael@0 64 #include "mozISpellCheckingEngine.h"
michael@0 65 #include "mozIPersonalDictionary.h"
michael@0 66 #include "nsString.h"
michael@0 67 #include "nsCOMPtr.h"
michael@0 68 #include "nsCOMArray.h"
michael@0 69 #include "nsIMemoryReporter.h"
michael@0 70 #include "nsIObserver.h"
michael@0 71 #include "nsIUnicodeEncoder.h"
michael@0 72 #include "nsIUnicodeDecoder.h"
michael@0 73 #include "nsInterfaceHashtable.h"
michael@0 74 #include "nsWeakReference.h"
michael@0 75 #include "nsCycleCollectionParticipant.h"
michael@0 76 #include "mozHunspellAllocator.h"
michael@0 77
michael@0 78 #define MOZ_HUNSPELL_CONTRACTID "@mozilla.org/spellchecker/engine;1"
michael@0 79 #define MOZ_HUNSPELL_CID \
michael@0 80 /* 56c778e4-1bee-45f3-a689-886692a97fe7 */ \
michael@0 81 { 0x56c778e4, 0x1bee, 0x45f3, \
michael@0 82 { 0xa6, 0x89, 0x88, 0x66, 0x92, 0xa9, 0x7f, 0xe7 } }
michael@0 83
michael@0 84 class mozHunspell : public mozISpellCheckingEngine,
michael@0 85 public nsIObserver,
michael@0 86 public nsSupportsWeakReference,
michael@0 87 public nsIMemoryReporter
michael@0 88 {
michael@0 89 public:
michael@0 90 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
michael@0 91 NS_DECL_MOZISPELLCHECKINGENGINE
michael@0 92 NS_DECL_NSIOBSERVER
michael@0 93 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(mozHunspell, mozISpellCheckingEngine)
michael@0 94
michael@0 95 mozHunspell();
michael@0 96 virtual ~mozHunspell();
michael@0 97
michael@0 98 nsresult Init();
michael@0 99
michael@0 100 void LoadDictionaryList();
michael@0 101
michael@0 102 // helper method for converting a word to the charset of the dictionary
michael@0 103 nsresult ConvertCharset(const char16_t* aStr, char ** aDst);
michael@0 104
michael@0 105 NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
michael@0 106 nsISupports* aData)
michael@0 107 {
michael@0 108 return MOZ_COLLECT_REPORT(
michael@0 109 "explicit/spell-check", KIND_HEAP, UNITS_BYTES, HunspellAllocator::MemoryAllocated(),
michael@0 110 "Memory used by the spell-checking engine.");
michael@0 111 }
michael@0 112
michael@0 113 protected:
michael@0 114
michael@0 115 nsCOMPtr<mozIPersonalDictionary> mPersonalDictionary;
michael@0 116 nsCOMPtr<nsIUnicodeEncoder> mEncoder;
michael@0 117 nsCOMPtr<nsIUnicodeDecoder> mDecoder;
michael@0 118
michael@0 119 // Hashtable matches dictionary name to .aff file
michael@0 120 nsInterfaceHashtable<nsStringHashKey, nsIFile> mDictionaries;
michael@0 121 nsString mDictionary;
michael@0 122 nsString mLanguage;
michael@0 123 nsCString mAffixFileName;
michael@0 124
michael@0 125 // dynamic dirs used to search for dictionaries
michael@0 126 nsCOMArray<nsIFile> mDynamicDirectories;
michael@0 127
michael@0 128 Hunspell *mHunspell;
michael@0 129 };
michael@0 130
michael@0 131 #endif

mercurial