bug 26237; adding language atom service

This commit is contained in:
erik%netscape.com 2000-05-03 00:45:45 +00:00
Родитель ce5e53d790
Коммит af156def97
2 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -38,6 +38,7 @@
#include "nsDateTimeFormatCID.h"
#include "nsCollationCID.h"
#include "nsIServiceManager.h"
#include "nsILanguageAtomService.h"
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
@ -50,6 +51,11 @@ NS_DEFINE_IID(kWin32LocaleFactoryCID, NS_WIN32LOCALEFACTORY_CID);
NS_DEFINE_IID(kIWin32LocaleIID,NS_IWIN32LOCALE_IID);
NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID);
//
// for language atoms
//
NS_DEFINE_CID(kLanguageAtomServiceCID, NS_LANGUAGEATOMSERVICE_CID);
//
// for the collation and formatting interfaces
//
@ -213,6 +219,16 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *
NS_ASSERTION(NS_SUCCEEDED(rv),"nsLocaleTest: Register ScriptableDateFormat failed.");
if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
//
// register the scriptable date time formatter
//
rv = compMgr->RegisterComponent(kLanguageAtomServiceCID,
"Language Atom Service", NS_LANGUAGEATOMSERVICE_PROGID, path, PR_TRUE,
PR_TRUE);
NS_ASSERTION(NS_SUCCEEDED(rv),
"nsLocaleTest: Register LanguageAtomService failed.");
if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
@ -253,6 +269,9 @@ extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char
rv = compMgr->UnregisterComponent(kScriptableDateFormatCID, path);
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kLanguageAtomServiceCID, path);
if (NS_FAILED(rv)) goto done;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;

Просмотреть файл

@ -29,6 +29,7 @@
#include "nsDateTimeFormatWin.h"
#include "nsIScriptableDateFormat.h"
#include "nsLocalefactoryWin.h"
#include "nsLanguageAtomService.h"
NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -37,6 +38,7 @@ NS_DEFINE_IID(kICollationFactoryIID, NS_ICOLLATIONFACTORY_IID);
NS_DEFINE_IID(kICollationIID, NS_ICOLLATION_IID);
NS_DEFINE_IID(kIDateTimeFormatIID, NS_IDATETIMEFORMAT_IID);
NS_DEFINE_CID(kScriptableDateFormatCID, NS_SCRIPTABLEDATEFORMAT_CID);
NS_DEFINE_CID(kLanguageAtomServiceCID, NS_LANGUAGEATOMSERVICE_CID);
nsLocaleWinFactory::nsLocaleWinFactory(const nsCID &aClass)
@ -78,6 +80,9 @@ nsresult nsLocaleWinFactory::CreateInstance(nsISupports *aOuter,
else if (mClassID.Equals(kScriptableDateFormatCID)) {
inst = NEW_SCRIPTABLE_DATEFORMAT();
}
else if (mClassID.Equals(kLanguageAtomServiceCID)) {
NS_NEWXPCOM(inst, nsLanguageAtomService);
}
else
{
return NS_NOINTERFACE;