Back to index

lightning-sunbird  0.9+nobinonly
nsIServiceManagerObsolete.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is XPCOM.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nsIServiceManagerObsolete_h___
00039 #define nsIServiceManagerObsolete_h___
00040 
00042 //
00043 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
00044 //
00045 // Functions, classes, interfaces and types in this file  are 
00046 // obsolete.  Use at your own risk.  
00047 // Please see nsIServiceManager.idl for the supported interface
00048 // to the service manager.
00049 //
00051 
00052 #include "nsIComponentManager.h"
00053 #include "nsID.h"
00054 
00055 #ifndef nsCOMPtr_h___
00056 #include "nsCOMPtr.h"
00057 #endif
00058 
00059 class nsIServiceManager;
00060 class nsIShutdownListener;
00061 class nsIDirectoryServiceProvider;
00062 
00063 class nsServiceManagerObsolete;
00064 
00065 #define NS_ISERVICEMANAGER_OBSOLETE_IID              \
00066 { /* cf0df3b0-3401-11d2-8163-006008119d7a */         \
00067     0xcf0df3b0,                                      \
00068     0x3401,                                          \
00069     0x11d2,                                          \
00070     {0x81, 0x63, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
00071 }
00072 
00077 class nsIServiceManagerObsolete : public nsISupports {
00078 public:
00079 
00080     NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISERVICEMANAGER_OBSOLETE_IID);
00081 
00088     NS_IMETHOD
00089     RegisterService(const nsCID& aClass, nsISupports* aService) = 0;
00090 
00101     NS_IMETHOD
00102     UnregisterService(const nsCID& aClass) = 0;
00103 
00104     NS_IMETHOD
00105     GetService(const nsCID& aClass, const nsIID& aIID,
00106                nsISupports* *result,
00107                nsIShutdownListener* shutdownListener = nsnull) = 0;
00108 
00109     /* OBSOLETE: use NS_RELEASE(service) instead. */
00110     NS_IMETHOD
00111     ReleaseService(const nsCID& aClass, nsISupports* service,
00112                    nsIShutdownListener* shutdownListener = nsnull) = 0;
00113 
00115     // let's do it again, this time with ContractIDs...
00116 
00117     NS_IMETHOD
00118     RegisterService(const char* aContractID, nsISupports* aService) = 0;
00119 
00120     NS_IMETHOD
00121     UnregisterService(const char* aContractID) = 0;
00122 
00123     NS_IMETHOD
00124     GetService(const char* aContractID, const nsIID& aIID,
00125                nsISupports* *result,
00126                nsIShutdownListener* shutdownListener = nsnull) = 0;
00127 
00128     /* OBSOLETE */
00129     NS_IMETHOD
00130     ReleaseService(const char* aContractID, nsISupports* service,
00131                    nsIShutdownListener* shutdownListener = nsnull) = 0;
00132 
00133 };
00134 
00135 // Interface to Global Services
00136 class NS_COM nsServiceManager {
00137 public:
00138 
00139     static nsresult
00140     RegisterService(const nsCID& aClass, nsISupports* aService);
00141 
00142     static nsresult
00143     UnregisterService(const nsCID& aClass);
00144 
00145     static nsresult
00146     GetService(const nsCID& aClass, const nsIID& aIID,
00147                nsISupports* *result,
00148                nsIShutdownListener* shutdownListener = nsnull);
00149 
00150     /* OBSOLETE: use NS_RELEASE(service) instead. */
00151     static nsresult
00152     ReleaseService(const nsCID& aClass, nsISupports* service,
00153                    nsIShutdownListener* shutdownListener = nsnull);
00154 
00156     // let's do it again, this time with ContractIDs...
00157 
00158     static nsresult
00159     RegisterService(const char* aContractID, nsISupports* aService);
00160 
00161     static nsresult
00162     UnregisterService(const char* aContractID);
00163 
00164     static nsresult
00165     GetService(const char* aContractID, const nsIID& aIID,
00166                nsISupports* *result,
00167                nsIShutdownListener* shutdownListener = nsnull);
00168 
00169     /* OBSOLETE: use NS_RELEASE(service) instead. */
00170     static nsresult
00171     ReleaseService(const char* aContractID, nsISupports* service,
00172                    nsIShutdownListener* shutdownListener = nsnull);
00173 
00174 
00176     // These methods return really nsIServiceManagerObsolete, but they are 
00177     // statically cast to nsIServiceManager to preserve backwards compatiblity.
00178     static nsresult GetGlobalServiceManager(nsIServiceManager* *result);
00179     static nsresult ShutdownGlobalServiceManager(nsIServiceManager* *result);
00180 };
00181 
00182 
00183 #define NS_DECL_NSISERVICEMANAGEROBSOLETE \
00184     NS_IMETHOD RegisterService(const nsCID& aClass, nsISupports* aService); \
00185     NS_IMETHOD UnregisterService(const nsCID& aClass);\
00186     NS_IMETHOD GetService(const nsCID& aClass, const nsIID& aIID, nsISupports* *result, nsIShutdownListener* shutdownListener);\
00187     NS_IMETHOD ReleaseService(const nsCID& aClass, nsISupports* service, nsIShutdownListener* shutdownListener);\
00188     NS_IMETHOD RegisterService(const char* aContractID, nsISupports* aService);\
00189     NS_IMETHOD UnregisterService(const char* aContractID);\
00190     NS_IMETHOD GetService(const char* aContractID, const nsIID& aIID, nsISupports* *result, nsIShutdownListener* shutdownListener);\
00191     NS_IMETHOD ReleaseService(const char* aContractID, nsISupports* service, nsIShutdownListener* shutdownListener);
00192 
00194 
00195 #define NS_ISHUTDOWNLISTENER_IID                     \
00196 { /* 56decae0-3406-11d2-8163-006008119d7a */         \
00197     0x56decae0,                                      \
00198     0x3406,                                          \
00199     0x11d2,                                          \
00200     {0x81, 0x63, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
00201 }
00202 
00204 
00205 
00206 #endif /* nsIServiceManagerObsolete_h___ */