зеркало из https://github.com/mozilla/pjs.git
Scriptable date format.
This commit is contained in:
Родитель
6a11bba809
Коммит
ccdcb03d08
|
@ -20,6 +20,7 @@
|
|||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsCollationMac.h"
|
||||
#include "nsIScriptableDateFormat.h"
|
||||
#include "nsDateTimeFormatCID.h"
|
||||
#include "nsDateTimeFormatMac.h"
|
||||
#include "nsLocaleFactoryMac.h"
|
||||
|
@ -30,6 +31,7 @@ NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
|||
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);
|
||||
|
||||
|
||||
nsLocaleMacFactory::nsLocaleMacFactory(const nsCID &aClass)
|
||||
|
@ -105,6 +107,9 @@ nsresult nsLocaleMacFactory::CreateInstance(nsISupports *aOuter,
|
|||
else if (aIID.Equals(nsIScriptableDateFormat::GetIID())) {
|
||||
inst = NEW_SCRIPTABLE_DATEFORMAT();
|
||||
}
|
||||
else if (mClassID.Equals(kScriptableDateFormatCID)) {
|
||||
inst = NEW_SCRIPTABLE_DATEFORMAT();
|
||||
}
|
||||
else
|
||||
{
|
||||
return NS_NOINTERFACE;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsILocaleService.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsCollationMac.h"
|
||||
#include "nsIScriptableDateFormat.h"
|
||||
#include "nsDateTimeFormatMac.h"
|
||||
#include "nsLocaleFactoryMac.h"
|
||||
#include "nsDateTimeFormatCID.h"
|
||||
|
@ -54,6 +55,7 @@ NS_DEFINE_IID(kIDateTimeFormatIID, NS_IDATETIMEFORMAT_IID);
|
|||
NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
|
||||
NS_DEFINE_CID(kCollationCID, NS_COLLATION_CID);
|
||||
NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
||||
NS_DEFINE_CID(kScriptableDateFormatCID, NS_SCRIPTABLEDATEFORMAT_CID);
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
|
@ -197,6 +199,14 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *
|
|||
NS_ASSERTION(rv==NS_OK,"nsLocaleTest: Register DateTimeFormat failed.");
|
||||
if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
|
||||
|
||||
//
|
||||
// register the scriptable date time formatter
|
||||
//
|
||||
rv = compMgr->RegisterComponent(kScriptableDateFormatCID, "Scriptable Date Format",
|
||||
NS_SCRIPTABLEDATEFORMAT_PROGID, path, PR_TRUE, PR_TRUE);
|
||||
NS_ASSERTION(rv==NS_OK,"nsLocaleTest: Register ScriptableDateFormat failed.");
|
||||
if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
|
||||
|
||||
done:
|
||||
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
|
||||
return rv;
|
||||
|
@ -227,6 +237,9 @@ extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char
|
|||
rv = compMgr->UnregisterComponent(kDateTimeFormatCID, path);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kScriptableDateFormatCID, path);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
done:
|
||||
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
|
||||
return rv;
|
||||
|
|
Загрузка…
Ссылка в новой задаче