VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/build/nsXPCOM.h

最後變更 在這個檔案是 106112,由 vboxsync 提交於 6 月 前

libs/xpcom: Fix building code using the XPCOM SDK bindings outside of VirtualBox, ticketref:22714 bugref:10773

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 7.3 KB
 
1/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38#ifndef nsXPCOM_h__
39#define nsXPCOM_h__
40
41#include "nscore.h"
42#include "nsXPCOMCID.h"
43
44#ifdef VBOX
45# include <iprt/thread.h>
46#endif
47
48#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
49#define NS_IsXPCOMInitialized VBoxNsxpNS_IsXPCOMInitialized
50#define NS_InitXPCOM2 VBoxNsxpNS_InitXPCOM2
51#define NS_ShutdownXPCOM VBoxNsxpNS_ShutdownXPCOM
52#define NS_NewNativeLocalFile VBoxNsxpNS_NewNativeLocalFile
53#define NS_GetServiceManager VBoxNsxpNS_GetServiceManager
54#define NS_GetComponentManager VBoxNsxpNS_GetComponentManager
55#define NS_GetComponentRegistrar VBoxNsxpNS_GetComponentRegistrar
56#define NS_GetDebug VBoxNsxpNS_GetDebug
57#define NS_GetMemoryManager VBoxNsxpNS_GetMemoryManager
58#define NS_GetTraceRefcnt VBoxNsxpNS_GetTraceRefcnt
59#define NS_NewLocalFile VBoxNsxpNS_NewLocalFile
60#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
61
62class nsAString;
63class nsACString;
64
65class nsIComponentManager;
66class nsIComponentRegistrar;
67class nsIServiceManager;
68class nsIFile;
69class nsILocalFile;
70class nsIDirectoryServiceProvider;
71class nsIDebug;
72class nsITraceRefcnt;
73
74#ifdef VBOX
75typedef RTTHREADINT *RTTHREAD;
76
77/**
78 * Checks whether XPCOM was initialized by a call to NS_InitXPCOM2().
79 */
80extern "C" NS_COM PRBool
81NS_IsXPCOMInitialized(void);
82
83extern "C" NS_COM nsresult
84NS_GetMainThread(RTTHREAD *phThreadMain);
85#endif
86
87/**
88 * Initialises XPCOM. You must call this method before proceeding
89 * to use xpcom. The one exception is that you may call
90 * NS_NewLocalFile to create a nsIFile.
91 *
92 * @status FROZEN
93 *
94 * @note Use <CODE>NS_NewLocalFile</CODE> or <CODE>NS_NewNativeLocalFile</CODE>
95 * to create the file object you supply as the bin directory path in this
96 * call. The function may be safely called before the rest of XPCOM or
97 * embedding has been initialised.
98 *
99 * @param result The service manager. You may pass null.
100 *
101 * @param binDirectory The directory containing the component
102 * registry and runtime libraries;
103 * or use <CODE>nsnull</CODE> to use the working
104 * directory.
105 *
106 * @param appFileLocationProvider The object to be used by Gecko that specifies
107 * to Gecko where to find profiles, the component
108 * registry preferences and so on; or use
109 * <CODE>nsnull</CODE> for the default behaviour.
110 *
111 * @see NS_NewLocalFile
112 * @see nsILocalFile
113 * @see nsIDirectoryServiceProvider
114 *
115 * @return NS_OK for success;
116 * NS_ERROR_NOT_INITIALIZED if static globals were not initialied, which
117 * can happen if XPCOM is reloaded, but did not completly shutdown.
118 * other error codes indicate a failure during initialisation.
119 *
120 */
121extern "C" NS_COM nsresult
122NS_InitXPCOM2(nsIServiceManager* *result,
123 nsIFile* binDirectory,
124 nsIDirectoryServiceProvider* appFileLocationProvider);
125/**
126 * Shutdown XPCOM. You must call this method after you are finished
127 * using xpcom.
128 *
129 * @status FROZEN
130 *
131 * @param servMgr The service manager which was returned by NS_InitXPCOM2.
132 * This will release servMgr. You may pass null.
133 *
134 * @return NS_OK for success;
135 * other error codes indicate a failure during initialisation.
136 *
137 */
138extern "C" NS_COM nsresult
139NS_ShutdownXPCOM(nsIServiceManager* servMgr);
140
141
142/**
143 * Public Method to access to the service manager.
144 *
145 * @status FROZEN
146 * @param result Interface pointer to the service manager
147 *
148 * @return NS_OK for success;
149 * other error codes indicate a failure during initialisation.
150 *
151 */
152extern "C" NS_COM nsresult
153NS_GetServiceManager(nsIServiceManager* *result);
154
155/**
156 * Public Method to access to the component manager.
157 *
158 * @status FROZEN
159 * @param result Interface pointer to the service
160 *
161 * @return NS_OK for success;
162 * other error codes indicate a failure during initialisation.
163 *
164 */
165extern "C" NS_COM nsresult
166NS_GetComponentManager(nsIComponentManager* *result);
167
168/**
169 * Public Method to access to the component registration manager.
170 *
171 * @status FROZEN
172 * @param result Interface pointer to the service
173 *
174 * @return NS_OK for success;
175 * other error codes indicate a failure during initialisation.
176 *
177 */
178extern "C" NS_COM nsresult
179NS_GetComponentRegistrar(nsIComponentRegistrar* *result);
180
181/**
182 * Public Method to create an instance of a nsILocalFile. This function
183 * may be called prior to NS_InitXPCOM2.
184 *
185 * @status FROZEN
186 *
187 * @param path
188 * A string which specifies a full file path to a
189 * location. Relative paths will be treated as an
190 * error (NS_ERROR_FILE_UNRECOGNIZED_PATH).
191 * |NS_NewNativeLocalFile|'s path must be in the
192 * filesystem charset.
193 * @param followLinks
194 * This attribute will determine if the nsLocalFile will auto
195 * resolve symbolic links. By default, this value will be false
196 * on all non unix systems. On unix, this attribute is effectively
197 * a noop.
198 * @param result Interface pointer to a new instance of an nsILocalFile
199 *
200 * @return NS_OK for success;
201 * other error codes indicate a failure.
202 */
203
204extern "C" NS_COM nsresult
205NS_NewLocalFile(const nsAString &path,
206 PRBool followLinks,
207 nsILocalFile* *result);
208
209extern "C" NS_COM nsresult
210NS_NewNativeLocalFile(const nsACString &path,
211 PRBool followLinks,
212 nsILocalFile* *result);
213
214
215extern "C" NS_COM nsresult
216NS_GetDebug(nsIDebug* *result);
217
218extern "C" NS_COM nsresult
219NS_GetTraceRefcnt(nsITraceRefcnt* *result);
220
221#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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