VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/build/nsXPCOMPrivate.h@ 44770

最後變更 在這個檔案從44770是 11551,由 vboxsync 提交於 16 年 前

API/xpcom: prefix any C symbols in VBoxXPCOM.so, to avoid namespace pollution. Enabled only on Linux at the moment.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 8.5 KB
 
1/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* vim:set ts=4 sw=4 et cindent: */
3/* ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is mozilla.org code.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39#ifndef nsXPComPrivate_h__
40#define nsXPComPrivate_h__
41
42#include "nscore.h"
43#include "nsXPCOM.h"
44
45class nsStringContainer;
46class nsCStringContainer;
47
48#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
49#define NS_GetFrozenFunctions VBoxNsxpNS_GetFrozenFunctions
50#define NS_RegisterXPCOMExitRoutine VBoxNsxpNS_RegisterXPCOMExitRoutine
51#define NS_UnregisterXPCOMExitRoutine VBoxNsxpNS_UnregisterXPCOMExitRoutine
52#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
53
54/**
55 * Private Method to register an exit routine. This method
56 * allows you to setup a callback that will be called from
57 * the NS_ShutdownXPCOM function after all services and
58 * components have gone away.
59 *
60 * This API is for the exclusive use of the xpcom glue library.
61 *
62 * Note that these APIs are NOT threadsafe and must be called on the
63 * main thread.
64 *
65 * @status FROZEN
66 * @param exitRoutine pointer to user defined callback function
67 * of type XPCOMExitRoutine.
68 * @param priority higher priorities are called before lower
69 * priorities.
70 *
71 * @return NS_OK for success;
72 * other error codes indicate a failure.
73 *
74 */
75typedef NS_CALLBACK(XPCOMExitRoutine)(void);
76
77extern "C" NS_COM nsresult
78NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority);
79
80extern "C" NS_COM nsresult
81NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine);
82
83
84// PUBLIC
85typedef nsresult (* InitFunc)(nsIServiceManager* *result, nsIFile* binDirectory, nsIDirectoryServiceProvider* appFileLocationProvider);
86typedef nsresult (* ShutdownFunc)(nsIServiceManager* servMgr);
87typedef nsresult (* GetServiceManagerFunc)(nsIServiceManager* *result);
88typedef nsresult (* GetComponentManagerFunc)(nsIComponentManager* *result);
89typedef nsresult (* GetComponentRegistrarFunc)(nsIComponentRegistrar* *result);
90typedef nsresult (* GetMemoryManagerFunc)(nsIMemory* *result);
91typedef nsresult (* NewLocalFileFunc)(const nsAString &path, PRBool followLinks, nsILocalFile* *result);
92typedef nsresult (* NewNativeLocalFileFunc)(const nsACString &path, PRBool followLinks, nsILocalFile* *result);
93
94typedef nsresult (* GetDebugFunc)(nsIDebug* *result);
95typedef nsresult (* GetTraceRefcntFunc)(nsITraceRefcnt* *result);
96
97typedef nsresult (* StringContainerInitFunc)(nsStringContainer&);
98typedef void (* StringContainerFinishFunc)(nsStringContainer&);
99typedef PRUint32 (* StringGetDataFunc)(const nsAString&, const PRUnichar**, PRBool*);
100typedef PRUnichar* (* StringCloneDataFunc)(const nsAString&);
101typedef nsresult (* StringSetDataFunc)(nsAString&, const PRUnichar*, PRUint32);
102typedef nsresult (* StringSetDataRangeFunc)(nsAString&, PRUint32, PRUint32, const PRUnichar*, PRUint32);
103typedef nsresult (* StringCopyFunc)(nsAString &, const nsAString &);
104
105typedef nsresult (* CStringContainerInitFunc)(nsCStringContainer&);
106typedef void (* CStringContainerFinishFunc)(nsCStringContainer&);
107typedef PRUint32 (* CStringGetDataFunc)(const nsACString&, const char**, PRBool*);
108typedef char* (* CStringCloneDataFunc)(const nsACString&);
109typedef nsresult (* CStringSetDataFunc)(nsACString&, const char*, PRUint32);
110typedef nsresult (* CStringSetDataRangeFunc)(nsACString&, PRUint32, PRUint32, const char*, PRUint32);
111typedef nsresult (* CStringCopyFunc)(nsACString &, const nsACString &);
112
113typedef nsresult (* CStringToUTF16)(const nsACString &, PRUint32, const nsAString &);
114typedef nsresult (* UTF16ToCString)(const nsAString &, PRUint32, const nsACString &);
115
116// PRIVATE
117typedef nsresult (* RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine, PRUint32 priority);
118typedef nsresult (* UnregisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine);
119
120typedef struct XPCOMFunctions{
121 PRUint32 version;
122 PRUint32 size;
123
124 InitFunc init;
125 ShutdownFunc shutdown;
126 GetServiceManagerFunc getServiceManager;
127 GetComponentManagerFunc getComponentManager;
128 GetComponentRegistrarFunc getComponentRegistrar;
129 GetMemoryManagerFunc getMemoryManager;
130 NewLocalFileFunc newLocalFile;
131 NewNativeLocalFileFunc newNativeLocalFile;
132
133 RegisterXPCOMExitRoutineFunc registerExitRoutine;
134 UnregisterXPCOMExitRoutineFunc unregisterExitRoutine;
135
136 // Added for Mozilla 1.5
137 GetDebugFunc getDebug;
138 GetTraceRefcntFunc getTraceRefcnt;
139
140 // Added for Mozilla 1.7
141 StringContainerInitFunc stringContainerInit;
142 StringContainerFinishFunc stringContainerFinish;
143 StringGetDataFunc stringGetData;
144 StringSetDataFunc stringSetData;
145 StringSetDataRangeFunc stringSetDataRange;
146 StringCopyFunc stringCopy;
147 CStringContainerInitFunc cstringContainerInit;
148 CStringContainerFinishFunc cstringContainerFinish;
149 CStringGetDataFunc cstringGetData;
150 CStringSetDataFunc cstringSetData;
151 CStringSetDataRangeFunc cstringSetDataRange;
152 CStringCopyFunc cstringCopy;
153 CStringToUTF16 cstringToUTF16;
154 UTF16ToCString utf16ToCString;
155 StringCloneDataFunc stringCloneData;
156 CStringCloneDataFunc cstringCloneData;
157
158} XPCOMFunctions;
159
160typedef nsresult (PR_CALLBACK *GetFrozenFunctionsFunc)(XPCOMFunctions *entryPoints, const char* libraryPath);
161extern "C" NS_COM nsresult
162NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath);
163
164// think hard before changing this
165#define XPCOM_GLUE_VERSION 1
166
167
168/* XPCOM Specific Defines
169 *
170 * XPCOM_DLL - name of the loadable xpcom library on disk.
171 * XPCOM_SEARCH_KEY - name of the environment variable that can be
172 * modified to include additional search paths.
173 * GRE_CONF_NAME - Name of the GRE Configuration file
174 */
175
176#ifdef XPCOM_DLL_BASE
177#define XPCOM_DLL XPCOM_DLL_BASE MOZ_DLL_SUFFIX
178#endif
179
180#if defined(XP_WIN32) || defined(XP_OS2)
181
182#define XPCOM_SEARCH_KEY "PATH"
183#define GRE_CONF_NAME "gre.config"
184#define GRE_WIN_REG_LOC "Software\\mozilla.org\\GRE\\"
185#ifndef XPCOM_DLL
186#define XPCOM_DLL "xpcom"MOZ_DLL_SUFFIX
187#endif
188
189#elif defined(XP_BEOS)
190
191#define XPCOM_SEARCH_KEY "ADDON_PATH"
192#define GRE_CONF_NAME ".gre.config"
193#define GRE_CONF_PATH "/boot/home/config/settings/GRE/gre.conf"
194#ifndef XPCOM_DLL
195#define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
196#endif
197
198#else // Unix
199
200#ifndef XPCOM_DLL
201#define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
202#endif
203
204// you have to love apple..
205#ifdef XP_MACOSX
206#define XPCOM_SEARCH_KEY "DYLD_LIBRARY_PATH"
207#else
208#define XPCOM_SEARCH_KEY "LD_LIBRARY_PATH"
209#endif
210
211#define GRE_CONF_NAME ".gre.config"
212#define GRE_CONF_PATH "/etc/gre.conf"
213#define GRE_CONF_DIR "/etc/gre.d/"
214#endif
215
216#if defined(XP_WIN) || defined(XP_OS2)
217 #define XPCOM_FILE_PATH_SEPARATOR "\\"
218 #define XPCOM_ENV_PATH_SEPARATOR ";"
219#elif defined(XP_UNIX) || defined(XP_BEOS)
220 #define XPCOM_FILE_PATH_SEPARATOR "/"
221 #define XPCOM_ENV_PATH_SEPARATOR ":"
222#else
223 #error need_to_define_your_file_path_separator_and_illegal_characters
224#endif
225
226#endif
227
228
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette