From fdba323f1ac79fc312ae40cac71aa72e4fbc35ab Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Wed, 24 Mar 1999 00:40:29 +0000 Subject: [PATCH] Added ProgID versions of RegisterService and UnregisterService. git-svn-id: svn://10.0.0.236/trunk@24932 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/components/nsIServiceManager.h | 9 +++ mozilla/xpcom/components/nsServiceManager.cpp | 75 +++++++++++++------ mozilla/xpcom/public/nsIServiceManager.h | 9 +++ mozilla/xpcom/src/nsServiceManager.cpp | 75 +++++++++++++------ 4 files changed, 122 insertions(+), 46 deletions(-) diff --git a/mozilla/xpcom/components/nsIServiceManager.h b/mozilla/xpcom/components/nsIServiceManager.h index d8c6665c580..b8f0f0f5116 100644 --- a/mozilla/xpcom/components/nsIServiceManager.h +++ b/mozilla/xpcom/components/nsIServiceManager.h @@ -109,6 +109,15 @@ public: ReleaseService(const nsCID& aClass, nsISupports* service, nsIShutdownListener* shutdownListener = NULL) = 0; + //////////////////////////////////////////////////////////////////////////// + // let's do it again, this time with ProgIDs... + + NS_IMETHOD + RegisterService(const char* aProgID, nsISupports* aService) = 0; + + NS_IMETHOD + UnregisterService(const char* aProgID) = 0; + NS_IMETHOD GetService(const char* aProgID, const nsIID& aIID, nsISupports* *result, diff --git a/mozilla/xpcom/components/nsServiceManager.cpp b/mozilla/xpcom/components/nsServiceManager.cpp index a6d980ff28a..b0ac135115c 100644 --- a/mozilla/xpcom/components/nsServiceManager.cpp +++ b/mozilla/xpcom/components/nsServiceManager.cpp @@ -133,6 +133,12 @@ public: ReleaseService(const nsCID& aClass, nsISupports* service, nsIShutdownListener* shutdownListener = NULL); + NS_IMETHOD + RegisterService(const char* aProgID, nsISupports* aService); + + NS_IMETHOD + UnregisterService(const char* aProgID); + NS_IMETHOD GetService(const char* aProgID, const nsIID& aIID, nsISupports* *result, @@ -288,29 +294,6 @@ nsServiceManagerImpl::ReleaseService(const nsCID& aClass, nsISupports* service, return rv; } -NS_IMETHODIMP -nsServiceManagerImpl::GetService(const char* aProgID, const nsIID& aIID, - nsISupports* *result, - nsIShutdownListener* shutdownListener) -{ - nsCID aClass; - nsresult rv; - rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); - if (NS_FAILED(rv)) return rv; - return GetService(aClass, aIID, result, shutdownListener); -} - -NS_IMETHODIMP -nsServiceManagerImpl::ReleaseService(const char* aProgID, nsISupports* service, - nsIShutdownListener* shutdownListener) -{ - nsCID aClass; - nsresult rv; - rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); - if (NS_FAILED(rv)) return rv; - return ReleaseService(aClass, service, shutdownListener); -} - NS_IMETHODIMP nsServiceManagerImpl::RegisterService(const nsCID& aClass, nsISupports* aService) { @@ -365,6 +348,52 @@ nsServiceManagerImpl::UnregisterService(const nsCID& aClass) return rv; } +//////////////////////////////////////////////////////////////////////////////// +// let's do it again, this time with ProgIDs... + +NS_IMETHODIMP +nsServiceManagerImpl::RegisterService(const char* aProgID, nsISupports* aService) +{ + nsCID aClass; + nsresult rv; + rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); + if (NS_FAILED(rv)) return rv; + return RegisterService(aClass, aService); +} + +NS_IMETHODIMP +nsServiceManagerImpl::UnregisterService(const char* aProgID) +{ + nsCID aClass; + nsresult rv; + rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); + if (NS_FAILED(rv)) return rv; + return UnregisterService(aClass); +} + +NS_IMETHODIMP +nsServiceManagerImpl::GetService(const char* aProgID, const nsIID& aIID, + nsISupports* *result, + nsIShutdownListener* shutdownListener) +{ + nsCID aClass; + nsresult rv; + rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); + if (NS_FAILED(rv)) return rv; + return GetService(aClass, aIID, result, shutdownListener); +} + +NS_IMETHODIMP +nsServiceManagerImpl::ReleaseService(const char* aProgID, nsISupports* service, + nsIShutdownListener* shutdownListener) +{ + nsCID aClass; + nsresult rv; + rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); + if (NS_FAILED(rv)) return rv; + return ReleaseService(aClass, service, shutdownListener); +} + //////////////////////////////////////////////////////////////////////////////// nsresult diff --git a/mozilla/xpcom/public/nsIServiceManager.h b/mozilla/xpcom/public/nsIServiceManager.h index d8c6665c580..b8f0f0f5116 100644 --- a/mozilla/xpcom/public/nsIServiceManager.h +++ b/mozilla/xpcom/public/nsIServiceManager.h @@ -109,6 +109,15 @@ public: ReleaseService(const nsCID& aClass, nsISupports* service, nsIShutdownListener* shutdownListener = NULL) = 0; + //////////////////////////////////////////////////////////////////////////// + // let's do it again, this time with ProgIDs... + + NS_IMETHOD + RegisterService(const char* aProgID, nsISupports* aService) = 0; + + NS_IMETHOD + UnregisterService(const char* aProgID) = 0; + NS_IMETHOD GetService(const char* aProgID, const nsIID& aIID, nsISupports* *result, diff --git a/mozilla/xpcom/src/nsServiceManager.cpp b/mozilla/xpcom/src/nsServiceManager.cpp index a6d980ff28a..b0ac135115c 100644 --- a/mozilla/xpcom/src/nsServiceManager.cpp +++ b/mozilla/xpcom/src/nsServiceManager.cpp @@ -133,6 +133,12 @@ public: ReleaseService(const nsCID& aClass, nsISupports* service, nsIShutdownListener* shutdownListener = NULL); + NS_IMETHOD + RegisterService(const char* aProgID, nsISupports* aService); + + NS_IMETHOD + UnregisterService(const char* aProgID); + NS_IMETHOD GetService(const char* aProgID, const nsIID& aIID, nsISupports* *result, @@ -288,29 +294,6 @@ nsServiceManagerImpl::ReleaseService(const nsCID& aClass, nsISupports* service, return rv; } -NS_IMETHODIMP -nsServiceManagerImpl::GetService(const char* aProgID, const nsIID& aIID, - nsISupports* *result, - nsIShutdownListener* shutdownListener) -{ - nsCID aClass; - nsresult rv; - rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); - if (NS_FAILED(rv)) return rv; - return GetService(aClass, aIID, result, shutdownListener); -} - -NS_IMETHODIMP -nsServiceManagerImpl::ReleaseService(const char* aProgID, nsISupports* service, - nsIShutdownListener* shutdownListener) -{ - nsCID aClass; - nsresult rv; - rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); - if (NS_FAILED(rv)) return rv; - return ReleaseService(aClass, service, shutdownListener); -} - NS_IMETHODIMP nsServiceManagerImpl::RegisterService(const nsCID& aClass, nsISupports* aService) { @@ -365,6 +348,52 @@ nsServiceManagerImpl::UnregisterService(const nsCID& aClass) return rv; } +//////////////////////////////////////////////////////////////////////////////// +// let's do it again, this time with ProgIDs... + +NS_IMETHODIMP +nsServiceManagerImpl::RegisterService(const char* aProgID, nsISupports* aService) +{ + nsCID aClass; + nsresult rv; + rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); + if (NS_FAILED(rv)) return rv; + return RegisterService(aClass, aService); +} + +NS_IMETHODIMP +nsServiceManagerImpl::UnregisterService(const char* aProgID) +{ + nsCID aClass; + nsresult rv; + rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); + if (NS_FAILED(rv)) return rv; + return UnregisterService(aClass); +} + +NS_IMETHODIMP +nsServiceManagerImpl::GetService(const char* aProgID, const nsIID& aIID, + nsISupports* *result, + nsIShutdownListener* shutdownListener) +{ + nsCID aClass; + nsresult rv; + rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); + if (NS_FAILED(rv)) return rv; + return GetService(aClass, aIID, result, shutdownListener); +} + +NS_IMETHODIMP +nsServiceManagerImpl::ReleaseService(const char* aProgID, nsISupports* service, + nsIShutdownListener* shutdownListener) +{ + nsCID aClass; + nsresult rv; + rv = nsComponentManager::ProgIDToCLSID(aProgID, &aClass); + if (NS_FAILED(rv)) return rv; + return ReleaseService(aClass, service, shutdownListener); +} + //////////////////////////////////////////////////////////////////////////////// nsresult