Back to index

lightning-sunbird  0.9+nobinonly
nsXPCOM.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 8; 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 mozilla.org code.
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  *   Benjamin Smedberg <benjamin@smedbergs.us>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef nsXPCOM_h__
00040 #define nsXPCOM_h__
00041 
00042 // Map frozen functions to private symbol names if not using strict API.
00043 #ifdef MOZILLA_INTERNAL_API
00044 # define NS_InitXPCOM2               NS_InitXPCOM2_P
00045 # define NS_InitXPCOM3               NS_InitXPCOM3_P
00046 # define NS_ShutdownXPCOM            NS_ShutdownXPCOM_P
00047 # define NS_GetServiceManager        NS_GetServiceManager_P
00048 # define NS_GetComponentManager      NS_GetComponentManager_P
00049 # define NS_GetComponentRegistrar    NS_GetComponentRegistrar_P
00050 # define NS_GetMemoryManager         NS_GetMemoryManager_P
00051 # define NS_NewLocalFile             NS_NewLocalFile_P
00052 # define NS_NewNativeLocalFile       NS_NewNativeLocalFile_P
00053 # define NS_GetDebug                 NS_GetDebug_P
00054 # define NS_GetTraceRefcnt           NS_GetTraceRefcnt_P
00055 # define NS_Alloc                    NS_Alloc_P
00056 # define NS_Realloc                  NS_Realloc_P
00057 # define NS_Free                     NS_Free_P
00058 #endif
00059 
00060 #include "nscore.h"
00061 #include "nsXPCOMCID.h"
00062 
00063 class nsAString;
00064 class nsACString;
00065 
00066 class nsIModule;
00067 class nsIComponentManager;
00068 class nsIComponentRegistrar;
00069 class nsIServiceManager;
00070 class nsIFile;
00071 class nsILocalFile;
00072 class nsIDirectoryServiceProvider;
00073 class nsIMemory;
00074 class nsIDebug;
00075 class nsITraceRefcnt;
00076 
00083 typedef nsresult (PR_CALLBACK *nsGetModuleProc)(nsIComponentManager *aCompMgr,
00084                                                 nsIFile* location,
00085                                                 nsIModule** return_cobj);
00086 
00121 extern "C" NS_COM nsresult
00122 NS_InitXPCOM2(nsIServiceManager* *result, 
00123               nsIFile* binDirectory,
00124               nsIDirectoryServiceProvider* appFileLocationProvider);
00125 
00133 struct nsStaticModuleInfo {
00134   const char      *name;
00135   nsGetModuleProc  getModule;
00136 };
00137 
00178 extern "C" NS_COM nsresult
00179 NS_InitXPCOM3(nsIServiceManager* *result, 
00180               nsIFile* binDirectory,
00181               nsIDirectoryServiceProvider* appFileLocationProvider,
00182               nsStaticModuleInfo const *staticComponents,
00183               PRUint32 componentCount);
00184 
00198 extern "C" NS_COM nsresult
00199 NS_ShutdownXPCOM(nsIServiceManager* servMgr);
00200 
00201 
00212 extern "C" NS_COM nsresult
00213 NS_GetServiceManager(nsIServiceManager* *result);
00214 
00225 extern "C" NS_COM nsresult
00226 NS_GetComponentManager(nsIComponentManager* *result);
00227 
00238 extern "C" NS_COM nsresult
00239 NS_GetComponentRegistrar(nsIComponentRegistrar* *result);
00240 
00251 extern "C" NS_COM nsresult
00252 NS_GetMemoryManager(nsIMemory* *result);
00253 
00277 extern "C" NS_COM nsresult
00278 NS_NewLocalFile(const nsAString &path, 
00279                 PRBool followLinks, 
00280                 nsILocalFile* *result);
00281 
00282 extern "C" NS_COM nsresult
00283 NS_NewNativeLocalFile(const nsACString &path, 
00284                       PRBool followLinks, 
00285                       nsILocalFile* *result);
00286 
00297 extern "C" NS_COM void*
00298 NS_Alloc(PRSize size);
00299 
00318 extern "C" NS_COM void*
00319 NS_Realloc(void* ptr, PRSize size);
00320 
00331 extern "C" NS_COM void
00332 NS_Free(void* ptr);
00333 
00334 
00348 #define XPCOM_DIRECTORY_PROVIDER_CATEGORY "xpcom-directory-providers"
00349 
00358 #define NS_XPCOM_STARTUP_CATEGORY "xpcom-startup"
00359 
00360 
00373 #define NS_XPCOM_STARTUP_OBSERVER_ID "xpcom-startup"
00374 
00382 #define NS_XPCOM_SHUTDOWN_OBSERVER_ID "xpcom-shutdown"
00383 
00392 #define NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID \
00393   "xpcom-category-entry-added"
00394 
00403 #define NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID \
00404   "xpcom-category-entry-removed"
00405 
00414 #define NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID "xpcom-category-cleared"
00415 
00416 extern "C" NS_COM nsresult
00417 NS_GetDebug(nsIDebug* *result);
00418 
00419 extern "C" NS_COM nsresult
00420 NS_GetTraceRefcnt(nsITraceRefcnt* *result);
00421 
00422 #endif