VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/components/nsComponentManagerObsolete.h@ 62330

Last change on this file since 62330 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.7 KB
Line 
1/* -*- Mode: C++; tab-width: 2; 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 XPCOM.
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#ifndef nsComponentManagerObsolete_h___
38#define nsComponentManagerObsolete_h___
39
40#include "nsIComponentManager.h"
41#include "nsIComponentManagerObsolete.h"
42
43class nsIEnumerator;
44class nsIFactory;
45class nsIFile;
46////////////////////////////////////////////////////////////////////
47//
48// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
49//
50// Functions, classes, interfaces and types in this file are
51// obsolete. Use at your own risk.
52// Please see nsIComponentManager.idl for the supported interface
53// to the component manager.
54//
55////////////////////////////////////////////////////////////////////
56
57
58
59////////////////////////////////////////////////////////////////////
60// God save me from this evilness. Below is a very bad
61// function. Its out var is really a nsIComponentManagerObsolete
62// but it has been cast to a nsIComponentManager.
63// The reason for such uglyness is that this function is require for
64// backward compatiblity of some plugins. This funciton will
65// be removed at some point.
66////////////////////////////////////////////////////////////////////
67
68extern NS_COM nsresult
69NS_GetGlobalComponentManager(nsIComponentManager* *result);
70
71
72
73
74class NS_COM nsComponentManager {
75public:
76 static nsresult Initialize(void);
77
78 // Finds a factory for a specific class ID
79 static nsresult FindFactory(const nsCID &aClass,
80 nsIFactory **aFactory);
81
82 // Get the singleton class object that implements the CID aClass
83 static nsresult GetClassObject(const nsCID &aClass, const nsIID &aIID,
84 void **aResult);
85
86 // Finds a class ID for a specific Program ID
87 static nsresult ContractIDToClassID(const char *aContractID,
88 nsCID *aClass);
89
90 // Finds a Program ID for a specific class ID
91 // caller frees the result with delete[]
92 static nsresult CLSIDToContractID(nsCID *aClass,
93 char* *aClassName,
94 char* *aContractID);
95
96 // Creates a class instance for a specific class ID
97 static nsresult CreateInstance(const nsCID &aClass,
98 nsISupports *aDelegate,
99 const nsIID &aIID,
100 void **aResult);
101
102 // Convenience routine, creates a class instance for a specific ContractID
103 static nsresult CreateInstance(const char *aContractID,
104 nsISupports *aDelegate,
105 const nsIID &aIID,
106 void **aResult);
107
108 // Manually registry a factory for a class
109 static nsresult RegisterFactory(const nsCID &aClass,
110 const char *aClassName,
111 const char *aContractID,
112 nsIFactory *aFactory,
113 PRBool aReplace);
114
115 // Manually register a dynamically loaded component.
116 // The libraryPersistentDescriptor is what gets passed to the library
117 // self register function from ComponentManager. The format of this string
118 // is the same as nsIFile::GetPath()
119 //
120 // This function will go away in favour of RegisterComponentSpec. In fact,
121 // it internally turns around and calls RegisterComponentSpec.
122 static nsresult RegisterComponent(const nsCID &aClass,
123 const char *aClassName,
124 const char *aContractID,
125 const char *aLibraryPersistentDescriptor,
126 PRBool aReplace,
127 PRBool aPersist);
128
129 // Register a component using its FileSpec as its identification
130 // This is the more prevalent use.
131 static nsresult RegisterComponentSpec(const nsCID &aClass,
132 const char *aClassName,
133 const char *aContractID,
134 nsIFile *aLibrary,
135 PRBool aReplace,
136 PRBool aPersist);
137
138 // Register a component using its dllName. This could be a dll name with
139 // no path so that LD_LIBRARY_PATH on unix or PATH on win can load it. Or
140 // this could be a code fragment name on the Mac.
141 static nsresult RegisterComponentLib(const nsCID &aClass,
142 const char *aClassName,
143 const char *aContractID,
144 const char *adllName,
145 PRBool aReplace,
146 PRBool aPersist);
147
148
149 // Manually unregister a factory for a class
150 static nsresult UnregisterFactory(const nsCID &aClass,
151 nsIFactory *aFactory);
152
153 // Manually unregister a dynamically loaded component
154 static nsresult UnregisterComponent(const nsCID &aClass,
155 const char *aLibrary);
156
157 // Manually unregister a dynamically loaded component
158 static nsresult UnregisterComponentSpec(const nsCID &aClass,
159 nsIFile *aLibrarySpec);
160
161 // Unload dynamically loaded factories that are not in use
162 static nsresult FreeLibraries(void);
163 //////////////////////////////////////////////////////////////////////////////
164 // DLL registration support
165
166 // If directory is NULL, then AutoRegister will try registering components
167 // in the default components directory.
168 static nsresult AutoRegister(PRInt32 when, nsIFile* directory);
169 static nsresult AutoRegisterComponent(PRInt32 when, nsIFile *component);
170 static nsresult AutoUnregisterComponent(PRInt32 when, nsIFile *component);
171
172 // Is the given CID currently registered?
173 static nsresult IsRegistered(const nsCID &aClass,
174 PRBool *aRegistered);
175
176 // Get an enumeration of all the CIDs
177 static nsresult EnumerateCLSIDs(nsIEnumerator** aEmumerator);
178
179 // Get an enumeration of all the ContractIDs
180 static nsresult EnumerateContractIDs(nsIEnumerator** aEmumerator);
181
182};
183
184
185#endif
Note: See TracBrowser for help on using the repository browser.

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