Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "mozilla/ModuleUtils.h" |
michael@0 | 7 | |
michael@0 | 8 | // lwbrk |
michael@0 | 9 | #include "nsLWBrkCIID.h" |
michael@0 | 10 | #include "nsJISx4051LineBreaker.h" |
michael@0 | 11 | #include "nsSampleWordBreaker.h" |
michael@0 | 12 | |
michael@0 | 13 | #include "nsSemanticUnitScanner.h" |
michael@0 | 14 | |
michael@0 | 15 | // unicharutil |
michael@0 | 16 | #include "nsCategoryImp.h" |
michael@0 | 17 | #include "nsUnicharUtilCIID.h" |
michael@0 | 18 | #include "nsCaseConversionImp2.h" |
michael@0 | 19 | #include "nsEntityConverter.h" |
michael@0 | 20 | #include "nsSaveAsCharset.h" |
michael@0 | 21 | #include "nsUnicodeNormalizer.h" |
michael@0 | 22 | |
michael@0 | 23 | // string bundles (intl) |
michael@0 | 24 | #include "nsStringBundleService.h" |
michael@0 | 25 | #include "nsStringBundleTextOverride.h" |
michael@0 | 26 | |
michael@0 | 27 | // locale |
michael@0 | 28 | #include "nsLocaleConstructors.h" |
michael@0 | 29 | |
michael@0 | 30 | // uconv |
michael@0 | 31 | #include "nsCharsetConverterManager.h" |
michael@0 | 32 | |
michael@0 | 33 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsJISx4051LineBreaker) |
michael@0 | 34 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsSampleWordBreaker) |
michael@0 | 35 | |
michael@0 | 36 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsSemanticUnitScanner) |
michael@0 | 37 | |
michael@0 | 38 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleService, Init) |
michael@0 | 39 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleTextOverride, Init) |
michael@0 | 40 | |
michael@0 | 41 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsCaseConversionImp2) |
michael@0 | 42 | NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsCategoryImp, |
michael@0 | 43 | nsCategoryImp::GetInstance) |
michael@0 | 44 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsEntityConverter) |
michael@0 | 45 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsSaveAsCharset) |
michael@0 | 46 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeNormalizer) |
michael@0 | 47 | |
michael@0 | 48 | NS_DEFINE_NAMED_CID(NS_LBRK_CID); |
michael@0 | 49 | NS_DEFINE_NAMED_CID(NS_WBRK_CID); |
michael@0 | 50 | NS_DEFINE_NAMED_CID(NS_SEMANTICUNITSCANNER_CID); |
michael@0 | 51 | NS_DEFINE_NAMED_CID(NS_UNICHARUTIL_CID); |
michael@0 | 52 | NS_DEFINE_NAMED_CID(NS_UNICHARCATEGORY_CID); |
michael@0 | 53 | NS_DEFINE_NAMED_CID(NS_ENTITYCONVERTER_CID); |
michael@0 | 54 | NS_DEFINE_NAMED_CID(NS_SAVEASCHARSET_CID); |
michael@0 | 55 | NS_DEFINE_NAMED_CID(NS_UNICODE_NORMALIZER_CID); |
michael@0 | 56 | NS_DEFINE_NAMED_CID(NS_STRINGBUNDLESERVICE_CID); |
michael@0 | 57 | NS_DEFINE_NAMED_CID(NS_STRINGBUNDLETEXTOVERRIDE_CID); |
michael@0 | 58 | NS_DEFINE_NAMED_CID(NS_LOCALESERVICE_CID); |
michael@0 | 59 | NS_DEFINE_NAMED_CID(NS_COLLATIONFACTORY_CID); |
michael@0 | 60 | NS_DEFINE_NAMED_CID(NS_SCRIPTABLEDATEFORMAT_CID); |
michael@0 | 61 | NS_DEFINE_NAMED_CID(NS_LANGUAGEATOMSERVICE_CID); |
michael@0 | 62 | NS_DEFINE_NAMED_CID(NS_PLATFORMCHARSET_CID); |
michael@0 | 63 | #ifdef XP_WIN |
michael@0 | 64 | NS_DEFINE_NAMED_CID(NS_COLLATION_CID); |
michael@0 | 65 | NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); |
michael@0 | 66 | #endif |
michael@0 | 67 | #ifdef USE_UNIX_LOCALE |
michael@0 | 68 | NS_DEFINE_NAMED_CID(NS_COLLATION_CID); |
michael@0 | 69 | NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); |
michael@0 | 70 | #endif |
michael@0 | 71 | #ifdef USE_MAC_LOCALE |
michael@0 | 72 | NS_DEFINE_NAMED_CID(NS_COLLATION_CID); |
michael@0 | 73 | NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); |
michael@0 | 74 | #endif |
michael@0 | 75 | |
michael@0 | 76 | static const mozilla::Module::CIDEntry kIntlCIDs[] = { |
michael@0 | 77 | { &kNS_LBRK_CID, false, nullptr, nsJISx4051LineBreakerConstructor }, |
michael@0 | 78 | { &kNS_WBRK_CID, false, nullptr, nsSampleWordBreakerConstructor }, |
michael@0 | 79 | { &kNS_SEMANTICUNITSCANNER_CID, false, nullptr, nsSemanticUnitScannerConstructor }, |
michael@0 | 80 | { &kNS_UNICHARUTIL_CID, false, nullptr, nsCaseConversionImp2Constructor }, |
michael@0 | 81 | { &kNS_UNICHARCATEGORY_CID, false, nullptr, nsCategoryImpConstructor }, |
michael@0 | 82 | { &kNS_ENTITYCONVERTER_CID, false, nullptr, nsEntityConverterConstructor }, |
michael@0 | 83 | { &kNS_SAVEASCHARSET_CID, false, nullptr, nsSaveAsCharsetConstructor }, |
michael@0 | 84 | { &kNS_UNICODE_NORMALIZER_CID, false, nullptr, nsUnicodeNormalizerConstructor }, |
michael@0 | 85 | { &kNS_STRINGBUNDLESERVICE_CID, false, nullptr, nsStringBundleServiceConstructor }, |
michael@0 | 86 | { &kNS_STRINGBUNDLETEXTOVERRIDE_CID, false, nullptr, nsStringBundleTextOverrideConstructor }, |
michael@0 | 87 | { &kNS_LOCALESERVICE_CID, false, nullptr, CreateLocaleService }, |
michael@0 | 88 | { &kNS_COLLATIONFACTORY_CID, false, nullptr, nsCollationFactoryConstructor }, |
michael@0 | 89 | { &kNS_SCRIPTABLEDATEFORMAT_CID, false, nullptr, NS_NewScriptableDateFormat }, |
michael@0 | 90 | { &kNS_LANGUAGEATOMSERVICE_CID, false, nullptr, nsLanguageAtomServiceConstructor }, |
michael@0 | 91 | { &kNS_PLATFORMCHARSET_CID, false, nullptr, nsPlatformCharsetConstructor }, |
michael@0 | 92 | #ifdef XP_WIN |
michael@0 | 93 | { &kNS_COLLATION_CID, false, nullptr, nsCollationWinConstructor }, |
michael@0 | 94 | { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatWinConstructor }, |
michael@0 | 95 | #endif |
michael@0 | 96 | #ifdef USE_UNIX_LOCALE |
michael@0 | 97 | { &kNS_COLLATION_CID, false, nullptr, nsCollationUnixConstructor }, |
michael@0 | 98 | { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatUnixConstructor }, |
michael@0 | 99 | #endif |
michael@0 | 100 | #ifdef USE_MAC_LOCALE |
michael@0 | 101 | { &kNS_COLLATION_CID, false, nullptr, nsCollationMacUCConstructor }, |
michael@0 | 102 | { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatMacConstructor }, |
michael@0 | 103 | #endif |
michael@0 | 104 | { nullptr } |
michael@0 | 105 | }; |
michael@0 | 106 | |
michael@0 | 107 | static const mozilla::Module::ContractIDEntry kIntlContracts[] = { |
michael@0 | 108 | { NS_LBRK_CONTRACTID, &kNS_LBRK_CID }, |
michael@0 | 109 | { NS_WBRK_CONTRACTID, &kNS_WBRK_CID }, |
michael@0 | 110 | { NS_SEMANTICUNITSCANNER_CONTRACTID, &kNS_SEMANTICUNITSCANNER_CID }, |
michael@0 | 111 | { NS_UNICHARUTIL_CONTRACTID, &kNS_UNICHARUTIL_CID }, |
michael@0 | 112 | { NS_UNICHARCATEGORY_CONTRACTID, &kNS_UNICHARCATEGORY_CID }, |
michael@0 | 113 | { NS_ENTITYCONVERTER_CONTRACTID, &kNS_ENTITYCONVERTER_CID }, |
michael@0 | 114 | { NS_SAVEASCHARSET_CONTRACTID, &kNS_SAVEASCHARSET_CID }, |
michael@0 | 115 | { NS_UNICODE_NORMALIZER_CONTRACTID, &kNS_UNICODE_NORMALIZER_CID }, |
michael@0 | 116 | { NS_STRINGBUNDLE_CONTRACTID, &kNS_STRINGBUNDLESERVICE_CID }, |
michael@0 | 117 | { NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID, &kNS_STRINGBUNDLETEXTOVERRIDE_CID }, |
michael@0 | 118 | { NS_LOCALESERVICE_CONTRACTID, &kNS_LOCALESERVICE_CID }, |
michael@0 | 119 | { NS_COLLATIONFACTORY_CONTRACTID, &kNS_COLLATIONFACTORY_CID }, |
michael@0 | 120 | { NS_SCRIPTABLEDATEFORMAT_CONTRACTID, &kNS_SCRIPTABLEDATEFORMAT_CID }, |
michael@0 | 121 | { NS_LANGUAGEATOMSERVICE_CONTRACTID, &kNS_LANGUAGEATOMSERVICE_CID }, |
michael@0 | 122 | { NS_PLATFORMCHARSET_CONTRACTID, &kNS_PLATFORMCHARSET_CID }, |
michael@0 | 123 | #ifdef XP_WIN |
michael@0 | 124 | { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, |
michael@0 | 125 | { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, |
michael@0 | 126 | #endif |
michael@0 | 127 | #ifdef USE_UNIX_LOCALE |
michael@0 | 128 | { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, |
michael@0 | 129 | { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, |
michael@0 | 130 | #endif |
michael@0 | 131 | #ifdef USE_MAC_LOCALE |
michael@0 | 132 | { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, |
michael@0 | 133 | { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, |
michael@0 | 134 | #endif |
michael@0 | 135 | { nullptr } |
michael@0 | 136 | }; |
michael@0 | 137 | |
michael@0 | 138 | static void |
michael@0 | 139 | I18nModuleDtor() |
michael@0 | 140 | { |
michael@0 | 141 | nsCharsetConverterManager::Shutdown(); |
michael@0 | 142 | } |
michael@0 | 143 | |
michael@0 | 144 | static const mozilla::Module kIntlModule = { |
michael@0 | 145 | mozilla::Module::kVersion, |
michael@0 | 146 | kIntlCIDs, |
michael@0 | 147 | kIntlContracts, |
michael@0 | 148 | nullptr, |
michael@0 | 149 | nullptr, |
michael@0 | 150 | nullptr, |
michael@0 | 151 | I18nModuleDtor |
michael@0 | 152 | }; |
michael@0 | 153 | |
michael@0 | 154 | NSMODULE_DEFN(nsI18nModule) = &kIntlModule; |