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