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 | class nsAString;
|
---|
45 | class nsACString;
|
---|
46 |
|
---|
47 | class nsIComponentManager;
|
---|
48 | class nsIComponentRegistrar;
|
---|
49 | class nsIServiceManager;
|
---|
50 | class nsIFile;
|
---|
51 | class nsILocalFile;
|
---|
52 | class nsIDirectoryServiceProvider;
|
---|
53 | class nsIMemory;
|
---|
54 | class nsIDebug;
|
---|
55 | class nsITraceRefcnt;
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Initialises XPCOM. You must call this method before proceeding
|
---|
59 | * to use xpcom. The one exception is that you may call
|
---|
60 | * NS_NewLocalFile to create a nsIFile.
|
---|
61 | *
|
---|
62 | * @status FROZEN
|
---|
63 | *
|
---|
64 | * @note Use <CODE>NS_NewLocalFile</CODE> or <CODE>NS_NewNativeLocalFile</CODE>
|
---|
65 | * to create the file object you supply as the bin directory path in this
|
---|
66 | * call. The function may be safely called before the rest of XPCOM or
|
---|
67 | * embedding has been initialised.
|
---|
68 | *
|
---|
69 | * @param result The service manager. You may pass null.
|
---|
70 | *
|
---|
71 | * @param binDirectory The directory containing the component
|
---|
72 | * registry and runtime libraries;
|
---|
73 | * or use <CODE>nsnull</CODE> to use the working
|
---|
74 | * directory.
|
---|
75 | *
|
---|
76 | * @param appFileLocationProvider The object to be used by Gecko that specifies
|
---|
77 | * to Gecko where to find profiles, the component
|
---|
78 | * registry preferences and so on; or use
|
---|
79 | * <CODE>nsnull</CODE> for the default behaviour.
|
---|
80 | *
|
---|
81 | * @see NS_NewLocalFile
|
---|
82 | * @see nsILocalFile
|
---|
83 | * @see nsIDirectoryServiceProvider
|
---|
84 | *
|
---|
85 | * @return NS_OK for success;
|
---|
86 | * NS_ERROR_NOT_INITIALIZED if static globals were not initialied, which
|
---|
87 | * can happen if XPCOM is reloaded, but did not completly shutdown.
|
---|
88 | * other error codes indicate a failure during initialisation.
|
---|
89 | *
|
---|
90 | */
|
---|
91 | extern "C" NS_COM nsresult
|
---|
92 | NS_InitXPCOM2(nsIServiceManager* *result,
|
---|
93 | nsIFile* binDirectory,
|
---|
94 | nsIDirectoryServiceProvider* appFileLocationProvider);
|
---|
95 | /**
|
---|
96 | * Shutdown XPCOM. You must call this method after you are finished
|
---|
97 | * using xpcom.
|
---|
98 | *
|
---|
99 | * @status FROZEN
|
---|
100 | *
|
---|
101 | * @param servMgr The service manager which was returned by NS_InitXPCOM2.
|
---|
102 | * This will release servMgr. You may pass null.
|
---|
103 | *
|
---|
104 | * @return NS_OK for success;
|
---|
105 | * other error codes indicate a failure during initialisation.
|
---|
106 | *
|
---|
107 | */
|
---|
108 | extern "C" NS_COM nsresult
|
---|
109 | NS_ShutdownXPCOM(nsIServiceManager* servMgr);
|
---|
110 |
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Public Method to access to the service manager.
|
---|
114 | *
|
---|
115 | * @status FROZEN
|
---|
116 | * @param result Interface pointer to the service manager
|
---|
117 | *
|
---|
118 | * @return NS_OK for success;
|
---|
119 | * other error codes indicate a failure during initialisation.
|
---|
120 | *
|
---|
121 | */
|
---|
122 | extern "C" NS_COM nsresult
|
---|
123 | NS_GetServiceManager(nsIServiceManager* *result);
|
---|
124 |
|
---|
125 | /**
|
---|
126 | * Public Method to access to the component manager.
|
---|
127 | *
|
---|
128 | * @status FROZEN
|
---|
129 | * @param result Interface pointer to the service
|
---|
130 | *
|
---|
131 | * @return NS_OK for success;
|
---|
132 | * other error codes indicate a failure during initialisation.
|
---|
133 | *
|
---|
134 | */
|
---|
135 | extern "C" NS_COM nsresult
|
---|
136 | NS_GetComponentManager(nsIComponentManager* *result);
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * Public Method to access to the component registration manager.
|
---|
140 | *
|
---|
141 | * @status FROZEN
|
---|
142 | * @param result Interface pointer to the service
|
---|
143 | *
|
---|
144 | * @return NS_OK for success;
|
---|
145 | * other error codes indicate a failure during initialisation.
|
---|
146 | *
|
---|
147 | */
|
---|
148 | extern "C" NS_COM nsresult
|
---|
149 | NS_GetComponentRegistrar(nsIComponentRegistrar* *result);
|
---|
150 |
|
---|
151 | /**
|
---|
152 | * Public Method to access to the memory manager. See nsIMemory
|
---|
153 | *
|
---|
154 | * @status FROZEN
|
---|
155 | * @param result Interface pointer to the memory manager
|
---|
156 | *
|
---|
157 | * @return NS_OK for success;
|
---|
158 | * other error codes indicate a failure during initialisation.
|
---|
159 | *
|
---|
160 | */
|
---|
161 | extern "C" NS_COM nsresult
|
---|
162 | NS_GetMemoryManager(nsIMemory* *result);
|
---|
163 |
|
---|
164 | /**
|
---|
165 | * Public Method to create an instance of a nsILocalFile. This function
|
---|
166 | * may be called prior to NS_InitXPCOM2.
|
---|
167 | *
|
---|
168 | * @status FROZEN
|
---|
169 | *
|
---|
170 | * @param path
|
---|
171 | * A string which specifies a full file path to a
|
---|
172 | * location. Relative paths will be treated as an
|
---|
173 | * error (NS_ERROR_FILE_UNRECOGNIZED_PATH).
|
---|
174 | * |NS_NewNativeLocalFile|'s path must be in the
|
---|
175 | * filesystem charset.
|
---|
176 | * @param followLinks
|
---|
177 | * This attribute will determine if the nsLocalFile will auto
|
---|
178 | * resolve symbolic links. By default, this value will be false
|
---|
179 | * on all non unix systems. On unix, this attribute is effectively
|
---|
180 | * a noop.
|
---|
181 | * @param result Interface pointer to a new instance of an nsILocalFile
|
---|
182 | *
|
---|
183 | * @return NS_OK for success;
|
---|
184 | * other error codes indicate a failure.
|
---|
185 | */
|
---|
186 |
|
---|
187 | extern "C" NS_COM nsresult
|
---|
188 | NS_NewLocalFile(const nsAString &path,
|
---|
189 | PRBool followLinks,
|
---|
190 | nsILocalFile* *result);
|
---|
191 |
|
---|
192 | extern "C" NS_COM nsresult
|
---|
193 | NS_NewNativeLocalFile(const nsACString &path,
|
---|
194 | PRBool followLinks,
|
---|
195 | nsILocalFile* *result);
|
---|
196 |
|
---|
197 |
|
---|
198 | extern "C" NS_COM nsresult
|
---|
199 | NS_GetDebug(nsIDebug* *result);
|
---|
200 |
|
---|
201 | extern "C" NS_COM nsresult
|
---|
202 | NS_GetTraceRefcnt(nsITraceRefcnt* *result);
|
---|
203 |
|
---|
204 | #endif
|
---|