1 : /* ***** BEGIN LICENSE BLOCK *****
2 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 : *
4 : * The contents of this file are subject to the Mozilla Public License Version
5 : * 1.1 (the "License"); you may not use this file except in compliance with
6 : * the License. You may obtain a copy of the License at
7 : * http://www.mozilla.org/MPL/
8 : *
9 : * Software distributed under the License is distributed on an "AS IS" basis,
10 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 : * for the specific language governing rights and limitations under the
12 : * License.
13 : *
14 : * The Original Code is XPCOM.
15 : *
16 : * The Initial Developer of the Original Code is Netscape Communications Corp.
17 : * Portions created by the Initial Developer are Copyright (C) 2001
18 : * the Initial Developer. All Rights Reserved.
19 : *
20 : * Contributor(s):
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 2 or later (the "GPL"), or
24 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
25 : * in which case the provisions of the GPL or the LGPL are applicable instead
26 : * of those above. If you wish to allow use of your version of this file only
27 : * under the terms of either the GPL or the LGPL, and not to allow others to
28 : * use your version of this file under the terms of the MPL, indicate your
29 : * decision by deleting the provisions above and replace them with the notice
30 : * and other provisions required by the GPL or the LGPL. If you do not delete
31 : * the provisions above, a recipient may use your version of this file under
32 : * the terms of any one of the MPL, the GPL or the LGPL.
33 : *
34 : * ***** END LICENSE BLOCK ***** */
35 :
36 : #ifndef nsIClassInfoImpl_h__
37 : #define nsIClassInfoImpl_h__
38 :
39 : #include "nsIClassInfo.h"
40 : #include "nsISupportsImpl.h"
41 :
42 : #include NEW_H
43 :
44 : /**
45 : * This header file provides macros which help you make your class implement
46 : * nsIClassInfo. Implementing nsIClassInfo is particularly helpful if you have
47 : * a C++ class which implements multiple interfaces and which you access from
48 : * JavaScript. If that class implements nsIClassInfo, the JavaScript code
49 : * won't have to call QueryInterface on instances of the class; all methods
50 : * from all interfaces returned by GetInterfaces() will be available
51 : * automagically.
52 : *
53 : * Here's all you need to do. Given a class
54 : *
55 : * class nsFooBar : public nsIFoo, public nsIBar { };
56 : *
57 : * you should already have the following nsISupports implementation in its cpp
58 : * file:
59 : *
60 : * NS_IMPL_ISUPPORTS2(nsFooBar, nsIFoo, nsIBar).
61 : *
62 : * Change this to
63 : *
64 : * NS_IMPL_CLASSINFO(nsFooBar, NULL, 0, NS_FOOBAR_CID)
65 : * NS_IMPL_ISUPPORTS2_CI(nsFooBar, nsIFoo, nsIBar)
66 : *
67 : * If nsFooBar is threadsafe, change the 0 above to nsIClassInfo::THREADSAFE.
68 : * If it's a singleton, use nsIClassInfo::SINGLETON. The full list of flags is
69 : * in nsIClassInfo.idl.
70 : *
71 : * The NULL parameter is there so you can pass a function for converting from
72 : * an XPCOM object to a scriptable helper. Unless you're doing specialized JS
73 : * work, you can probably leave this as NULL.
74 : *
75 : * This file also defines the NS_IMPL_QUERY_INTERFACE2_CI macro, which you can
76 : * use to replace NS_IMPL_QUERY_INTERFACE2, if you use that instead of
77 : * NS_IMPL_ISUPPORTS2.
78 : *
79 : * That's it! The rest is gory details.
80 : *
81 : *
82 : * Notice that nsFooBar didn't need to inherit from nsIClassInfo in order to
83 : * "implement" it. However, after adding these macros to nsFooBar, you you can
84 : * QueryInterface an instance of nsFooBar to nsIClassInfo. How can this be?
85 : *
86 : * The answer lies in the NS_IMPL_ISUPPORTS2_CI macro. It modifies nsFooBar's
87 : * QueryInterface implementation such that, if we ask to QI to nsIClassInfo, it
88 : * returns a singleton object associated with the class. (That singleton is
89 : * defined by NS_IMPL_CLASSINFO.) So all nsFooBar instances will return the
90 : * same object when QI'ed to nsIClassInfo. (You can see this in
91 : * NS_IMPL_QUERY_CLASSINFO below.)
92 : *
93 : * This hack breaks XPCOM's rules, since if you take an instance of nsFooBar,
94 : * QI it to nsIClassInfo, and then try to QI to nsIFoo, that will fail. On the
95 : * upside, implementing nsIClassInfo doesn't add a vtable pointer to instances
96 : * of your class.
97 : *
98 : * In principal, you can also implement nsIClassInfo by inheriting from the
99 : * interface. But some code expects that when it QI's an object to
100 : * nsIClassInfo, it gets back a singleton which isn't attached to any
101 : * particular object. If a class were to implement nsIClassInfo through
102 : * inheritance, that code might QI to nsIClassInfo and keep the resulting
103 : * object alive, thinking it was only keeping alive the classinfo singleton,
104 : * but in fact keeping a whole instance of the class alive. See, e.g., bug
105 : * 658632.
106 : *
107 : * Unless you specifically need to have a different nsIClassInfo instance for
108 : * each instance of your class, you should probably just implement nsIClassInfo
109 : * as a singleton.
110 : */
111 :
112 : class NS_COM_GLUE GenericClassInfo : public nsIClassInfo
113 : {
114 : public:
115 : struct ClassInfoData
116 : {
117 : typedef NS_CALLBACK(GetInterfacesProc)(PRUint32* NS_OUTPARAM countp,
118 : nsIID*** NS_OUTPARAM array);
119 : typedef NS_CALLBACK(GetLanguageHelperProc)(PRUint32 language,
120 : nsISupports** helper);
121 :
122 : GetInterfacesProc getinterfaces;
123 : GetLanguageHelperProc getlanguagehelper;
124 : PRUint32 flags;
125 : nsCID cid;
126 : };
127 :
128 : NS_DECL_ISUPPORTS_INHERITED
129 : NS_DECL_NSICLASSINFO
130 :
131 6501 : GenericClassInfo(const ClassInfoData* data)
132 6501 : : mData(data)
133 6501 : { }
134 :
135 : private:
136 : const ClassInfoData* mData;
137 : };
138 :
139 : #define NS_CLASSINFO_NAME(_class) g##_class##_classInfoGlobal
140 : #define NS_CI_INTERFACE_GETTER_NAME(_class) _class##_GetInterfacesHelper
141 : #define NS_DECL_CI_INTERFACE_GETTER(_class) \
142 : extern NS_IMETHODIMP NS_CI_INTERFACE_GETTER_NAME(_class) \
143 : (PRUint32 * NS_OUTPARAM, nsIID *** NS_OUTPARAM);
144 :
145 : #define NS_IMPL_CLASSINFO(_class, _getlanguagehelper, _flags, _cid) \
146 : NS_DECL_CI_INTERFACE_GETTER(_class) \
147 : static const GenericClassInfo::ClassInfoData k##_class##ClassInfoData = { \
148 : NS_CI_INTERFACE_GETTER_NAME(_class), \
149 : _getlanguagehelper, \
150 : _flags, \
151 : _cid, \
152 : }; \
153 : static char k##_class##ClassInfoDataPlace[sizeof(GenericClassInfo)]; \
154 : nsIClassInfo* NS_CLASSINFO_NAME(_class) = NULL;
155 :
156 : #define NS_IMPL_QUERY_CLASSINFO(_class) \
157 : if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) { \
158 : if (!NS_CLASSINFO_NAME(_class)) \
159 : NS_CLASSINFO_NAME(_class) = new (k##_class##ClassInfoDataPlace) \
160 : GenericClassInfo(&k##_class##ClassInfoData); \
161 : foundInterface = NS_CLASSINFO_NAME(_class); \
162 : } else
163 :
164 : #define NS_CLASSINFO_HELPER_BEGIN(_class, _c) \
165 : NS_IMETHODIMP \
166 : NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *count NS_OUTPARAM, \
167 : nsIID ***array NS_OUTPARAM) \
168 : { \
169 : *count = _c; \
170 : *array = (nsIID **)nsMemory::Alloc(sizeof (nsIID *) * _c);
171 :
172 : #define NS_CLASSINFO_HELPER_ENTRY(_i, _interface) \
173 : (*array)[_i] = (nsIID *)nsMemory::Clone(&NS_GET_IID(_interface), \
174 : sizeof(nsIID));
175 :
176 : #define NS_CLASSINFO_HELPER_END \
177 : return NS_OK; \
178 : }
179 :
180 : #define NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface) \
181 : NS_CLASSINFO_HELPER_BEGIN(_class, 1) \
182 : NS_CLASSINFO_HELPER_ENTRY(0, _interface) \
183 : NS_CLASSINFO_HELPER_END
184 :
185 : #define NS_IMPL_QUERY_INTERFACE1_CI(_class, _i1) \
186 : NS_INTERFACE_MAP_BEGIN(_class) \
187 : NS_INTERFACE_MAP_ENTRY(_i1) \
188 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
189 : NS_IMPL_QUERY_CLASSINFO(_class) \
190 : NS_INTERFACE_MAP_END
191 :
192 : #define NS_IMPL_ISUPPORTS1_CI(_class, _interface) \
193 : NS_IMPL_ADDREF(_class) \
194 : NS_IMPL_RELEASE(_class) \
195 : NS_IMPL_QUERY_INTERFACE1_CI(_class, _interface) \
196 : NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface)
197 :
198 : #define NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2) \
199 : NS_CLASSINFO_HELPER_BEGIN(_class, 2) \
200 : NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
201 : NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
202 : NS_CLASSINFO_HELPER_END
203 :
204 : #define NS_IMPL_QUERY_INTERFACE2_CI(_class, _i1, _i2) \
205 : NS_INTERFACE_MAP_BEGIN(_class) \
206 : NS_INTERFACE_MAP_ENTRY(_i1) \
207 : NS_INTERFACE_MAP_ENTRY(_i2) \
208 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
209 : NS_IMPL_QUERY_CLASSINFO(_class) \
210 : NS_INTERFACE_MAP_END
211 :
212 : #define NS_IMPL_ISUPPORTS2_CI(_class, _i1, _i2) \
213 : NS_IMPL_ADDREF(_class) \
214 : NS_IMPL_RELEASE(_class) \
215 : NS_IMPL_QUERY_INTERFACE2_CI(_class, _i1, _i2) \
216 : NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2)
217 :
218 : #define NS_IMPL_CI_INTERFACE_GETTER3(_class, _i1, _i2, _i3) \
219 : NS_CLASSINFO_HELPER_BEGIN(_class, 3) \
220 : NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
221 : NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
222 : NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
223 : NS_CLASSINFO_HELPER_END
224 :
225 : #define NS_IMPL_QUERY_INTERFACE3_CI(_class, _i1, _i2, _i3) \
226 : NS_INTERFACE_MAP_BEGIN(_class) \
227 : NS_INTERFACE_MAP_ENTRY(_i1) \
228 : NS_INTERFACE_MAP_ENTRY(_i2) \
229 : NS_INTERFACE_MAP_ENTRY(_i3) \
230 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
231 : NS_IMPL_QUERY_CLASSINFO(_class) \
232 : NS_INTERFACE_MAP_END
233 :
234 : #define NS_IMPL_ISUPPORTS3_CI(_class, _i1, _i2, _i3) \
235 : NS_IMPL_ADDREF(_class) \
236 : NS_IMPL_RELEASE(_class) \
237 : NS_IMPL_QUERY_INTERFACE3_CI(_class, _i1, _i2, _i3) \
238 : NS_IMPL_CI_INTERFACE_GETTER3(_class, _i1, _i2, _i3)
239 :
240 : #define NS_IMPL_CI_INTERFACE_GETTER4(_class, _i1, _i2, _i3, _i4) \
241 : NS_CLASSINFO_HELPER_BEGIN(_class, 4) \
242 : NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
243 : NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
244 : NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
245 : NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
246 : NS_CLASSINFO_HELPER_END
247 :
248 : #define NS_IMPL_QUERY_INTERFACE4_CI(_class, _i1, _i2, _i3, _i4) \
249 : NS_INTERFACE_MAP_BEGIN(_class) \
250 : NS_INTERFACE_MAP_ENTRY(_i1) \
251 : NS_INTERFACE_MAP_ENTRY(_i2) \
252 : NS_INTERFACE_MAP_ENTRY(_i3) \
253 : NS_INTERFACE_MAP_ENTRY(_i4) \
254 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
255 : NS_IMPL_QUERY_CLASSINFO(_class) \
256 : NS_INTERFACE_MAP_END
257 :
258 : #define NS_IMPL_ISUPPORTS4_CI(_class, _i1, _i2, _i3, _i4) \
259 : NS_IMPL_ADDREF(_class) \
260 : NS_IMPL_RELEASE(_class) \
261 : NS_IMPL_QUERY_INTERFACE4_CI(_class, _i1, _i2, _i3, _i4) \
262 : NS_IMPL_CI_INTERFACE_GETTER4(_class, _i1, _i2, _i3, _i4)
263 :
264 : #define NS_IMPL_CI_INTERFACE_GETTER5(_class, _i1, _i2, _i3, _i4, _i5) \
265 : NS_CLASSINFO_HELPER_BEGIN(_class, 5) \
266 : NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
267 : NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
268 : NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
269 : NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
270 : NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
271 : NS_CLASSINFO_HELPER_END
272 :
273 : #define NS_IMPL_QUERY_INTERFACE5_CI(_class, _i1, _i2, _i3, _i4, _i5) \
274 : NS_INTERFACE_MAP_BEGIN(_class) \
275 : NS_INTERFACE_MAP_ENTRY(_i1) \
276 : NS_INTERFACE_MAP_ENTRY(_i2) \
277 : NS_INTERFACE_MAP_ENTRY(_i3) \
278 : NS_INTERFACE_MAP_ENTRY(_i4) \
279 : NS_INTERFACE_MAP_ENTRY(_i5) \
280 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
281 : NS_IMPL_QUERY_CLASSINFO(_class) \
282 : NS_INTERFACE_MAP_END
283 :
284 : #define NS_IMPL_ISUPPORTS5_CI(_class, _i1, _i2, _i3, _i4, _i5) \
285 : NS_IMPL_ADDREF(_class) \
286 : NS_IMPL_RELEASE(_class) \
287 : NS_IMPL_QUERY_INTERFACE5_CI(_class, _i1, _i2, _i3, _i4, _i5) \
288 : NS_IMPL_CI_INTERFACE_GETTER5(_class, _i1, _i2, _i3, _i4, _i5)
289 :
290 : #define NS_IMPL_CI_INTERFACE_GETTER6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
291 : NS_CLASSINFO_HELPER_BEGIN(_class, 6) \
292 : NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
293 : NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
294 : NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
295 : NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
296 : NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
297 : NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
298 : NS_CLASSINFO_HELPER_END
299 :
300 : #define NS_IMPL_QUERY_INTERFACE6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
301 : NS_INTERFACE_MAP_BEGIN(_class) \
302 : NS_INTERFACE_MAP_ENTRY(_i1) \
303 : NS_INTERFACE_MAP_ENTRY(_i2) \
304 : NS_INTERFACE_MAP_ENTRY(_i3) \
305 : NS_INTERFACE_MAP_ENTRY(_i4) \
306 : NS_INTERFACE_MAP_ENTRY(_i5) \
307 : NS_INTERFACE_MAP_ENTRY(_i6) \
308 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
309 : NS_IMPL_QUERY_CLASSINFO(_class) \
310 : NS_INTERFACE_MAP_END
311 :
312 : #define NS_IMPL_ISUPPORTS6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
313 : NS_IMPL_ADDREF(_class) \
314 : NS_IMPL_RELEASE(_class) \
315 : NS_IMPL_QUERY_INTERFACE6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
316 : NS_IMPL_CI_INTERFACE_GETTER6(_class, _i1, _i2, _i3, _i4, _i5, _i6)
317 :
318 : #define NS_IMPL_CI_INTERFACE_GETTER7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
319 : _i7) \
320 : NS_CLASSINFO_HELPER_BEGIN(_class, 7) \
321 : NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
322 : NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
323 : NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
324 : NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
325 : NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
326 : NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
327 : NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
328 : NS_CLASSINFO_HELPER_END
329 :
330 : #define NS_IMPL_QUERY_INTERFACE7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
331 : _i7) \
332 : NS_INTERFACE_MAP_BEGIN(_class) \
333 : NS_INTERFACE_MAP_ENTRY(_i1) \
334 : NS_INTERFACE_MAP_ENTRY(_i2) \
335 : NS_INTERFACE_MAP_ENTRY(_i3) \
336 : NS_INTERFACE_MAP_ENTRY(_i4) \
337 : NS_INTERFACE_MAP_ENTRY(_i5) \
338 : NS_INTERFACE_MAP_ENTRY(_i6) \
339 : NS_INTERFACE_MAP_ENTRY(_i7) \
340 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
341 : NS_IMPL_QUERY_CLASSINFO(_class) \
342 : NS_INTERFACE_MAP_END
343 :
344 : #define NS_IMPL_ISUPPORTS7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
345 : NS_IMPL_ADDREF(_class) \
346 : NS_IMPL_RELEASE(_class) \
347 : NS_IMPL_QUERY_INTERFACE7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
348 : NS_IMPL_CI_INTERFACE_GETTER7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7)
349 :
350 : #define NS_IMPL_CI_INTERFACE_GETTER8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
351 : _i7, _i8) \
352 : NS_CLASSINFO_HELPER_BEGIN(_class, 8) \
353 : NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
354 : NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
355 : NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
356 : NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
357 : NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
358 : NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
359 : NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
360 : NS_CLASSINFO_HELPER_ENTRY(7, _i8) \
361 : NS_CLASSINFO_HELPER_END
362 :
363 : #define NS_IMPL_QUERY_INTERFACE8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
364 : _i7, _i8) \
365 : NS_INTERFACE_MAP_BEGIN(_class) \
366 : NS_INTERFACE_MAP_ENTRY(_i1) \
367 : NS_INTERFACE_MAP_ENTRY(_i2) \
368 : NS_INTERFACE_MAP_ENTRY(_i3) \
369 : NS_INTERFACE_MAP_ENTRY(_i4) \
370 : NS_INTERFACE_MAP_ENTRY(_i5) \
371 : NS_INTERFACE_MAP_ENTRY(_i6) \
372 : NS_INTERFACE_MAP_ENTRY(_i7) \
373 : NS_INTERFACE_MAP_ENTRY(_i8) \
374 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
375 : NS_IMPL_QUERY_CLASSINFO(_class) \
376 : NS_INTERFACE_MAP_END
377 :
378 : #define NS_IMPL_ISUPPORTS8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
379 : NS_IMPL_ADDREF(_class) \
380 : NS_IMPL_RELEASE(_class) \
381 : NS_IMPL_QUERY_INTERFACE8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
382 : NS_IMPL_CI_INTERFACE_GETTER8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8)
383 :
384 : #define NS_IMPL_CI_INTERFACE_GETTER9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
385 : _i7, _i8, _i9) \
386 : NS_CLASSINFO_HELPER_BEGIN(_class, 9) \
387 : NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
388 : NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
389 : NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
390 : NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
391 : NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
392 : NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
393 : NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
394 : NS_CLASSINFO_HELPER_ENTRY(7, _i8) \
395 : NS_CLASSINFO_HELPER_ENTRY(8, _i9) \
396 : NS_CLASSINFO_HELPER_END
397 :
398 : #define NS_IMPL_QUERY_INTERFACE9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
399 : _i7, _i8, _i9) \
400 : NS_INTERFACE_MAP_BEGIN(_class) \
401 : NS_INTERFACE_MAP_ENTRY(_i1) \
402 : NS_INTERFACE_MAP_ENTRY(_i2) \
403 : NS_INTERFACE_MAP_ENTRY(_i3) \
404 : NS_INTERFACE_MAP_ENTRY(_i4) \
405 : NS_INTERFACE_MAP_ENTRY(_i5) \
406 : NS_INTERFACE_MAP_ENTRY(_i6) \
407 : NS_INTERFACE_MAP_ENTRY(_i7) \
408 : NS_INTERFACE_MAP_ENTRY(_i8) \
409 : NS_INTERFACE_MAP_ENTRY(_i9) \
410 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
411 : NS_IMPL_QUERY_CLASSINFO(_class) \
412 : NS_INTERFACE_MAP_END
413 :
414 : #define NS_IMPL_ISUPPORTS9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
415 : _i8, _i9) \
416 : NS_IMPL_ADDREF(_class) \
417 : NS_IMPL_RELEASE(_class) \
418 : NS_IMPL_QUERY_INTERFACE9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
419 : _i8, _i9) \
420 : NS_IMPL_CI_INTERFACE_GETTER9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
421 : _i8, _i9)
422 :
423 : #define NS_IMPL_CI_INTERFACE_GETTER10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
424 : _i7, _i8, _i9, _i10) \
425 : NS_CLASSINFO_HELPER_BEGIN(_class, 10) \
426 : NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
427 : NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
428 : NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
429 : NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
430 : NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
431 : NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
432 : NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
433 : NS_CLASSINFO_HELPER_ENTRY(7, _i8) \
434 : NS_CLASSINFO_HELPER_ENTRY(8, _i9) \
435 : NS_CLASSINFO_HELPER_ENTRY(9, _i10) \
436 : NS_CLASSINFO_HELPER_END
437 :
438 : #define NS_IMPL_CI_INTERFACE_GETTER11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
439 : _i7, _i8, _i9, _i10, _i11) \
440 : NS_CLASSINFO_HELPER_BEGIN(_class, 11) \
441 : NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
442 : NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
443 : NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
444 : NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
445 : NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
446 : NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
447 : NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
448 : NS_CLASSINFO_HELPER_ENTRY(7, _i8) \
449 : NS_CLASSINFO_HELPER_ENTRY(8, _i9) \
450 : NS_CLASSINFO_HELPER_ENTRY(9, _i10) \
451 : NS_CLASSINFO_HELPER_ENTRY(10, _i11) \
452 : NS_CLASSINFO_HELPER_END
453 :
454 : #define NS_IMPL_QUERY_INTERFACE10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
455 : _i7, _i8, _i9, _i10) \
456 : NS_INTERFACE_MAP_BEGIN(_class) \
457 : NS_INTERFACE_MAP_ENTRY(_i1) \
458 : NS_INTERFACE_MAP_ENTRY(_i2) \
459 : NS_INTERFACE_MAP_ENTRY(_i3) \
460 : NS_INTERFACE_MAP_ENTRY(_i4) \
461 : NS_INTERFACE_MAP_ENTRY(_i5) \
462 : NS_INTERFACE_MAP_ENTRY(_i6) \
463 : NS_INTERFACE_MAP_ENTRY(_i7) \
464 : NS_INTERFACE_MAP_ENTRY(_i8) \
465 : NS_INTERFACE_MAP_ENTRY(_i9) \
466 : NS_INTERFACE_MAP_ENTRY(_i10) \
467 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
468 : NS_IMPL_QUERY_CLASSINFO(_class) \
469 : NS_INTERFACE_MAP_END
470 :
471 : #define NS_IMPL_QUERY_INTERFACE11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
472 : _i7, _i8, _i9, _i10, _i11) \
473 : NS_INTERFACE_MAP_BEGIN(_class) \
474 : NS_INTERFACE_MAP_ENTRY(_i1) \
475 : NS_INTERFACE_MAP_ENTRY(_i2) \
476 : NS_INTERFACE_MAP_ENTRY(_i3) \
477 : NS_INTERFACE_MAP_ENTRY(_i4) \
478 : NS_INTERFACE_MAP_ENTRY(_i5) \
479 : NS_INTERFACE_MAP_ENTRY(_i6) \
480 : NS_INTERFACE_MAP_ENTRY(_i7) \
481 : NS_INTERFACE_MAP_ENTRY(_i8) \
482 : NS_INTERFACE_MAP_ENTRY(_i9) \
483 : NS_INTERFACE_MAP_ENTRY(_i10) \
484 : NS_INTERFACE_MAP_ENTRY(_i11) \
485 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
486 : NS_IMPL_QUERY_CLASSINFO(_class) \
487 : NS_INTERFACE_MAP_END
488 :
489 : #define NS_IMPL_ISUPPORTS10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
490 : _i8, _i9, _i10) \
491 : NS_IMPL_ADDREF(_class) \
492 : NS_IMPL_RELEASE(_class) \
493 : NS_IMPL_QUERY_INTERFACE10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
494 : _i8, _i9, _i10) \
495 : NS_IMPL_CI_INTERFACE_GETTER10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
496 : _i8, _i9, _i10)
497 :
498 : #define NS_IMPL_ISUPPORTS11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
499 : _i8, _i9, _i10, _i11) \
500 : NS_IMPL_ADDREF(_class) \
501 : NS_IMPL_RELEASE(_class) \
502 : NS_IMPL_QUERY_INTERFACE11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
503 : _i8, _i9, _i10, _i11) \
504 : NS_IMPL_CI_INTERFACE_GETTER11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
505 : _i8, _i9, _i10, _i11)
506 :
507 : #endif // nsIClassInfoImpl_h__
|