michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "mozilla/ModuleUtils.h" michael@0: michael@0: // lwbrk michael@0: #include "nsLWBrkCIID.h" michael@0: #include "nsJISx4051LineBreaker.h" michael@0: #include "nsSampleWordBreaker.h" michael@0: michael@0: #include "nsSemanticUnitScanner.h" michael@0: michael@0: // unicharutil michael@0: #include "nsCategoryImp.h" michael@0: #include "nsUnicharUtilCIID.h" michael@0: #include "nsCaseConversionImp2.h" michael@0: #include "nsEntityConverter.h" michael@0: #include "nsSaveAsCharset.h" michael@0: #include "nsUnicodeNormalizer.h" michael@0: michael@0: // string bundles (intl) michael@0: #include "nsStringBundleService.h" michael@0: #include "nsStringBundleTextOverride.h" michael@0: michael@0: // locale michael@0: #include "nsLocaleConstructors.h" michael@0: michael@0: // uconv michael@0: #include "nsCharsetConverterManager.h" michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsJISx4051LineBreaker) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsSampleWordBreaker) michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsSemanticUnitScanner) michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleService, Init) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleTextOverride, Init) michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsCaseConversionImp2) michael@0: NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsCategoryImp, michael@0: nsCategoryImp::GetInstance) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsEntityConverter) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsSaveAsCharset) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeNormalizer) michael@0: michael@0: NS_DEFINE_NAMED_CID(NS_LBRK_CID); michael@0: NS_DEFINE_NAMED_CID(NS_WBRK_CID); michael@0: NS_DEFINE_NAMED_CID(NS_SEMANTICUNITSCANNER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_UNICHARUTIL_CID); michael@0: NS_DEFINE_NAMED_CID(NS_UNICHARCATEGORY_CID); michael@0: NS_DEFINE_NAMED_CID(NS_ENTITYCONVERTER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_SAVEASCHARSET_CID); michael@0: NS_DEFINE_NAMED_CID(NS_UNICODE_NORMALIZER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_STRINGBUNDLESERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_STRINGBUNDLETEXTOVERRIDE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_LOCALESERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_COLLATIONFACTORY_CID); michael@0: NS_DEFINE_NAMED_CID(NS_SCRIPTABLEDATEFORMAT_CID); michael@0: NS_DEFINE_NAMED_CID(NS_LANGUAGEATOMSERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_PLATFORMCHARSET_CID); michael@0: #ifdef XP_WIN michael@0: NS_DEFINE_NAMED_CID(NS_COLLATION_CID); michael@0: NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); michael@0: #endif michael@0: #ifdef USE_UNIX_LOCALE michael@0: NS_DEFINE_NAMED_CID(NS_COLLATION_CID); michael@0: NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); michael@0: #endif michael@0: #ifdef USE_MAC_LOCALE michael@0: NS_DEFINE_NAMED_CID(NS_COLLATION_CID); michael@0: NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); michael@0: #endif michael@0: michael@0: static const mozilla::Module::CIDEntry kIntlCIDs[] = { michael@0: { &kNS_LBRK_CID, false, nullptr, nsJISx4051LineBreakerConstructor }, michael@0: { &kNS_WBRK_CID, false, nullptr, nsSampleWordBreakerConstructor }, michael@0: { &kNS_SEMANTICUNITSCANNER_CID, false, nullptr, nsSemanticUnitScannerConstructor }, michael@0: { &kNS_UNICHARUTIL_CID, false, nullptr, nsCaseConversionImp2Constructor }, michael@0: { &kNS_UNICHARCATEGORY_CID, false, nullptr, nsCategoryImpConstructor }, michael@0: { &kNS_ENTITYCONVERTER_CID, false, nullptr, nsEntityConverterConstructor }, michael@0: { &kNS_SAVEASCHARSET_CID, false, nullptr, nsSaveAsCharsetConstructor }, michael@0: { &kNS_UNICODE_NORMALIZER_CID, false, nullptr, nsUnicodeNormalizerConstructor }, michael@0: { &kNS_STRINGBUNDLESERVICE_CID, false, nullptr, nsStringBundleServiceConstructor }, michael@0: { &kNS_STRINGBUNDLETEXTOVERRIDE_CID, false, nullptr, nsStringBundleTextOverrideConstructor }, michael@0: { &kNS_LOCALESERVICE_CID, false, nullptr, CreateLocaleService }, michael@0: { &kNS_COLLATIONFACTORY_CID, false, nullptr, nsCollationFactoryConstructor }, michael@0: { &kNS_SCRIPTABLEDATEFORMAT_CID, false, nullptr, NS_NewScriptableDateFormat }, michael@0: { &kNS_LANGUAGEATOMSERVICE_CID, false, nullptr, nsLanguageAtomServiceConstructor }, michael@0: { &kNS_PLATFORMCHARSET_CID, false, nullptr, nsPlatformCharsetConstructor }, michael@0: #ifdef XP_WIN michael@0: { &kNS_COLLATION_CID, false, nullptr, nsCollationWinConstructor }, michael@0: { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatWinConstructor }, michael@0: #endif michael@0: #ifdef USE_UNIX_LOCALE michael@0: { &kNS_COLLATION_CID, false, nullptr, nsCollationUnixConstructor }, michael@0: { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatUnixConstructor }, michael@0: #endif michael@0: #ifdef USE_MAC_LOCALE michael@0: { &kNS_COLLATION_CID, false, nullptr, nsCollationMacUCConstructor }, michael@0: { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatMacConstructor }, michael@0: #endif michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const mozilla::Module::ContractIDEntry kIntlContracts[] = { michael@0: { NS_LBRK_CONTRACTID, &kNS_LBRK_CID }, michael@0: { NS_WBRK_CONTRACTID, &kNS_WBRK_CID }, michael@0: { NS_SEMANTICUNITSCANNER_CONTRACTID, &kNS_SEMANTICUNITSCANNER_CID }, michael@0: { NS_UNICHARUTIL_CONTRACTID, &kNS_UNICHARUTIL_CID }, michael@0: { NS_UNICHARCATEGORY_CONTRACTID, &kNS_UNICHARCATEGORY_CID }, michael@0: { NS_ENTITYCONVERTER_CONTRACTID, &kNS_ENTITYCONVERTER_CID }, michael@0: { NS_SAVEASCHARSET_CONTRACTID, &kNS_SAVEASCHARSET_CID }, michael@0: { NS_UNICODE_NORMALIZER_CONTRACTID, &kNS_UNICODE_NORMALIZER_CID }, michael@0: { NS_STRINGBUNDLE_CONTRACTID, &kNS_STRINGBUNDLESERVICE_CID }, michael@0: { NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID, &kNS_STRINGBUNDLETEXTOVERRIDE_CID }, michael@0: { NS_LOCALESERVICE_CONTRACTID, &kNS_LOCALESERVICE_CID }, michael@0: { NS_COLLATIONFACTORY_CONTRACTID, &kNS_COLLATIONFACTORY_CID }, michael@0: { NS_SCRIPTABLEDATEFORMAT_CONTRACTID, &kNS_SCRIPTABLEDATEFORMAT_CID }, michael@0: { NS_LANGUAGEATOMSERVICE_CONTRACTID, &kNS_LANGUAGEATOMSERVICE_CID }, michael@0: { NS_PLATFORMCHARSET_CONTRACTID, &kNS_PLATFORMCHARSET_CID }, michael@0: #ifdef XP_WIN michael@0: { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, michael@0: { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, michael@0: #endif michael@0: #ifdef USE_UNIX_LOCALE michael@0: { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, michael@0: { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, michael@0: #endif michael@0: #ifdef USE_MAC_LOCALE michael@0: { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, michael@0: { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, michael@0: #endif michael@0: { nullptr } michael@0: }; michael@0: michael@0: static void michael@0: I18nModuleDtor() michael@0: { michael@0: nsCharsetConverterManager::Shutdown(); michael@0: } michael@0: michael@0: static const mozilla::Module kIntlModule = { michael@0: mozilla::Module::kVersion, michael@0: kIntlCIDs, michael@0: kIntlContracts, michael@0: nullptr, michael@0: nullptr, michael@0: nullptr, michael@0: I18nModuleDtor michael@0: }; michael@0: michael@0: NSMODULE_DEFN(nsI18nModule) = &kIntlModule;