From 088146892f78148060b0324f790ec99d901d7c3f Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Tue, 9 Mar 1999 11:12:23 +0000 Subject: [PATCH] Commented out template because linux isn't happy with it. --- xpcom/components/nsIServiceManager.h | 22 ++++++++++++++++++++++ xpcom/public/nsIServiceManager.h | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/xpcom/components/nsIServiceManager.h b/xpcom/components/nsIServiceManager.h index 8d485659bef7..ee1d03ec2c51 100644 --- a/xpcom/components/nsIServiceManager.h +++ b/xpcom/components/nsIServiceManager.h @@ -133,6 +133,8 @@ public: // // and the automatic destructor will take care of releasing the service. +#if 0 + template class nsService { protected: const nsCID mCID; @@ -180,6 +182,26 @@ public: }; +#else + +#define NS_WITH_SERVICE(T, serv, isupports, cid, rv) \ +{ \ + T* serv; \ + const nsCID& _aClass = (cid); \ + nsISupports* _isupp = (isupports); \ + nsIServiceManager* _servMgr; \ + *(rv) = (_isupp)->QueryInterface(nsIServiceManager::GetIID(), (void**)&_servMgr); \ + if (NS_SUCCEEDED(*rv)) { \ + *(rv) = _servMgr->GetService(_aClass, T::GetIID(), (nsISupports**)&(serv)); \ + NS_RELEASE(_servMgr); \ + } \ + +#define NS_END_WITH_SERVICE(cid, serv) \ + _servMgr->ReleaseService(cid, serv); \ +} \ + +#endif + //////////////////////////////////////////////////////////////////////////////// #define NS_ISHUTDOWNLISTENER_IID \ diff --git a/xpcom/public/nsIServiceManager.h b/xpcom/public/nsIServiceManager.h index 8d485659bef7..ee1d03ec2c51 100644 --- a/xpcom/public/nsIServiceManager.h +++ b/xpcom/public/nsIServiceManager.h @@ -133,6 +133,8 @@ public: // // and the automatic destructor will take care of releasing the service. +#if 0 + template class nsService { protected: const nsCID mCID; @@ -180,6 +182,26 @@ public: }; +#else + +#define NS_WITH_SERVICE(T, serv, isupports, cid, rv) \ +{ \ + T* serv; \ + const nsCID& _aClass = (cid); \ + nsISupports* _isupp = (isupports); \ + nsIServiceManager* _servMgr; \ + *(rv) = (_isupp)->QueryInterface(nsIServiceManager::GetIID(), (void**)&_servMgr); \ + if (NS_SUCCEEDED(*rv)) { \ + *(rv) = _servMgr->GetService(_aClass, T::GetIID(), (nsISupports**)&(serv)); \ + NS_RELEASE(_servMgr); \ + } \ + +#define NS_END_WITH_SERVICE(cid, serv) \ + _servMgr->ReleaseService(cid, serv); \ +} \ + +#endif + //////////////////////////////////////////////////////////////////////////////// #define NS_ISHUTDOWNLISTENER_IID \