Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef nsHyphenationManager_h__
7 : #define nsHyphenationManager_h__
8 :
9 : #include "nsInterfaceHashtable.h"
10 : #include "nsRefPtrHashtable.h"
11 : #include "nsHashKeys.h"
12 : #include "nsIObserver.h"
13 : #include "mozilla/Omnijar.h"
14 :
15 : class nsHyphenator;
16 : class nsIAtom;
17 : class nsIURI;
18 :
19 : class nsHyphenationManager
20 : {
21 : public:
22 : nsHyphenationManager();
23 :
24 : already_AddRefed<nsHyphenator> GetHyphenator(nsIAtom *aLocale);
25 :
26 : static nsHyphenationManager *Instance();
27 :
28 : static void Shutdown();
29 :
30 : private:
31 : ~nsHyphenationManager();
32 :
33 : protected:
34 0 : class MemoryPressureObserver final : public nsIObserver
35 : {
36 0 : ~MemoryPressureObserver() {}
37 :
38 : public:
39 : NS_DECL_ISUPPORTS
40 : NS_DECL_NSIOBSERVER
41 : };
42 :
43 : void LoadPatternList();
44 : void LoadPatternListFromOmnijar(mozilla::Omnijar::Type aType);
45 : void LoadPatternListFromDir(nsIFile *aDir);
46 : void LoadAliases();
47 :
48 : nsInterfaceHashtable<nsISupportsHashKey,nsIAtom> mHyphAliases;
49 : nsInterfaceHashtable<nsISupportsHashKey,nsIURI> mPatternFiles;
50 : nsRefPtrHashtable<nsISupportsHashKey,nsHyphenator> mHyphenators;
51 :
52 : static nsHyphenationManager *sInstance;
53 : };
54 :
55 : #endif // nsHyphenationManager_h__
|