AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
queryinterface.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 
4 #ifndef INCLUDED_CPPUHELPER_QUERYINTERFACE_HXX
5 #define INCLUDED_CPPUHELPER_QUERYINTERFACE_HXX
6 
7 #include "sal/config.h"
10 #include "sal/types.h"
11 
12 namespace cppu
13 {
14 
22 template< class Interface1 >
23 inline css::uno::Any SAL_CALL queryInterface(
24  const css::uno::Type & rType,
25  Interface1 * p1 )
26 {
27  if (rType == Interface1::static_type())
28  return css::uno::Any( &p1, rType );
29  else
30  return css::uno::Any();
31 }
41 template< class Interface1, class Interface2 >
42 inline css::uno::Any SAL_CALL queryInterface(
43  const css::uno::Type & rType,
44  Interface1 * p1, Interface2 * p2 )
45 {
46  if (rType == Interface1::static_type())
47  return css::uno::Any( &p1, rType );
48  else if (rType == Interface2::static_type())
49  return css::uno::Any( &p2, rType );
50  else
51  return css::uno::Any();
52 }
64 template< class Interface1, class Interface2, class Interface3 >
65 inline css::uno::Any SAL_CALL queryInterface(
66  const css::uno::Type & rType,
67  Interface1 * p1, Interface2 * p2, Interface3 * p3 )
68 {
69  if (rType == Interface1::static_type())
70  return css::uno::Any( &p1, rType );
71  else if (rType == Interface2::static_type())
72  return css::uno::Any( &p2, rType );
73  else if (rType == Interface3::static_type())
74  return css::uno::Any( &p3, rType );
75  else
76  return css::uno::Any();
77 }
91 template< class Interface1, class Interface2, class Interface3, class Interface4 >
92 inline css::uno::Any SAL_CALL queryInterface(
93  const css::uno::Type & rType,
94  Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4 )
95 {
96  if (rType == Interface1::static_type())
97  return css::uno::Any( &p1, rType );
98  else if (rType == Interface2::static_type())
99  return css::uno::Any( &p2, rType );
100  else if (rType == Interface3::static_type())
101  return css::uno::Any( &p3, rType );
102  else if (rType == Interface4::static_type())
103  return css::uno::Any( &p4, rType );
104  else
105  return css::uno::Any();
106 }
122 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5 >
123 inline css::uno::Any SAL_CALL queryInterface(
124  const css::uno::Type & rType,
125  Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5 )
126 {
127  if (rType == Interface1::static_type())
128  return css::uno::Any( &p1, rType );
129  else if (rType == Interface2::static_type())
130  return css::uno::Any( &p2, rType );
131  else if (rType == Interface3::static_type())
132  return css::uno::Any( &p3, rType );
133  else if (rType == Interface4::static_type())
134  return css::uno::Any( &p4, rType );
135  else if (rType == Interface5::static_type())
136  return css::uno::Any( &p5, rType );
137  else
138  return css::uno::Any();
139 }
157 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
158  class Interface6 >
159 inline css::uno::Any SAL_CALL queryInterface(
160  const css::uno::Type & rType,
161  Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
162  Interface6 * p6 )
163 {
164  if (rType == Interface1::static_type())
165  return css::uno::Any( &p1, rType );
166  else if (rType == Interface2::static_type())
167  return css::uno::Any( &p2, rType );
168  else if (rType == Interface3::static_type())
169  return css::uno::Any( &p3, rType );
170  else if (rType == Interface4::static_type())
171  return css::uno::Any( &p4, rType );
172  else if (rType == Interface5::static_type())
173  return css::uno::Any( &p5, rType );
174  else if (rType == Interface6::static_type())
175  return css::uno::Any( &p6, rType );
176  else
177  return css::uno::Any();
178 }
198 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
199  class Interface6, class Interface7 >
200 inline css::uno::Any SAL_CALL queryInterface(
201  const css::uno::Type & rType,
202  Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
203  Interface6 * p6, Interface7 * p7 )
204 {
205  if (rType == Interface1::static_type())
206  return css::uno::Any( &p1, rType );
207  else if (rType == Interface2::static_type())
208  return css::uno::Any( &p2, rType );
209  else if (rType == Interface3::static_type())
210  return css::uno::Any( &p3, rType );
211  else if (rType == Interface4::static_type())
212  return css::uno::Any( &p4, rType );
213  else if (rType == Interface5::static_type())
214  return css::uno::Any( &p5, rType );
215  else if (rType == Interface6::static_type())
216  return css::uno::Any( &p6, rType );
217  else if (rType == Interface7::static_type())
218  return css::uno::Any( &p7, rType );
219  else
220  return css::uno::Any();
221 }
243 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
244  class Interface6, class Interface7, class Interface8 >
245 inline css::uno::Any SAL_CALL queryInterface(
246  const css::uno::Type & rType,
247  Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
248  Interface6 * p6, Interface7 * p7, Interface8 * p8 )
249 {
250  if (rType == Interface1::static_type())
251  return css::uno::Any( &p1, rType );
252  else if (rType == Interface2::static_type())
253  return css::uno::Any( &p2, rType );
254  else if (rType == Interface3::static_type())
255  return css::uno::Any( &p3, rType );
256  else if (rType == Interface4::static_type())
257  return css::uno::Any( &p4, rType );
258  else if (rType == Interface5::static_type())
259  return css::uno::Any( &p5, rType );
260  else if (rType == Interface6::static_type())
261  return css::uno::Any( &p6, rType );
262  else if (rType == Interface7::static_type())
263  return css::uno::Any( &p7, rType );
264  else if (rType == Interface8::static_type())
265  return css::uno::Any( &p8, rType );
266  else
267  return css::uno::Any();
268 }
292 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
293  class Interface6, class Interface7, class Interface8, class Interface9 >
294 inline css::uno::Any SAL_CALL queryInterface(
295  const css::uno::Type & rType,
296  Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
297  Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9 )
298 {
299  if (rType == Interface1::static_type())
300  return css::uno::Any( &p1, rType );
301  else if (rType == Interface2::static_type())
302  return css::uno::Any( &p2, rType );
303  else if (rType == Interface3::static_type())
304  return css::uno::Any( &p3, rType );
305  else if (rType == Interface4::static_type())
306  return css::uno::Any( &p4, rType );
307  else if (rType == Interface5::static_type())
308  return css::uno::Any( &p5, rType );
309  else if (rType == Interface6::static_type())
310  return css::uno::Any( &p6, rType );
311  else if (rType == Interface7::static_type())
312  return css::uno::Any( &p7, rType );
313  else if (rType == Interface8::static_type())
314  return css::uno::Any( &p8, rType );
315  else if (rType == Interface9::static_type())
316  return css::uno::Any( &p9, rType );
317  else
318  return css::uno::Any();
319 }
345 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
346  class Interface6, class Interface7, class Interface8, class Interface9, class Interface10 >
347 inline css::uno::Any SAL_CALL queryInterface(
348  const css::uno::Type & rType,
349  Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
350  Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10 )
351 {
352  if (rType == Interface1::static_type())
353  return css::uno::Any( &p1, rType );
354  else if (rType == Interface2::static_type())
355  return css::uno::Any( &p2, rType );
356  else if (rType == Interface3::static_type())
357  return css::uno::Any( &p3, rType );
358  else if (rType == Interface4::static_type())
359  return css::uno::Any( &p4, rType );
360  else if (rType == Interface5::static_type())
361  return css::uno::Any( &p5, rType );
362  else if (rType == Interface6::static_type())
363  return css::uno::Any( &p6, rType );
364  else if (rType == Interface7::static_type())
365  return css::uno::Any( &p7, rType );
366  else if (rType == Interface8::static_type())
367  return css::uno::Any( &p8, rType );
368  else if (rType == Interface9::static_type())
369  return css::uno::Any( &p9, rType );
370  else if (rType == Interface10::static_type())
371  return css::uno::Any( &p10, rType );
372  else
373  return css::uno::Any();
374 }
402 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
403  class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
404  class Interface11 >
405 inline css::uno::Any SAL_CALL queryInterface(
406  const css::uno::Type & rType,
407  Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
408  Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
409  Interface11 * p11 )
410 {
411  if (rType == Interface1::static_type())
412  return css::uno::Any( &p1, rType );
413  else if (rType == Interface2::static_type())
414  return css::uno::Any( &p2, rType );
415  else if (rType == Interface3::static_type())
416  return css::uno::Any( &p3, rType );
417  else if (rType == Interface4::static_type())
418  return css::uno::Any( &p4, rType );
419  else if (rType == Interface5::static_type())
420  return css::uno::Any( &p5, rType );
421  else if (rType == Interface6::static_type())
422  return css::uno::Any( &p6, rType );
423  else if (rType == Interface7::static_type())
424  return css::uno::Any( &p7, rType );
425  else if (rType == Interface8::static_type())
426  return css::uno::Any( &p8, rType );
427  else if (rType == Interface9::static_type())
428  return css::uno::Any( &p9, rType );
429  else if (rType == Interface10::static_type())
430  return css::uno::Any( &p10, rType );
431  else if (rType == Interface11::static_type())
432  return css::uno::Any( &p11, rType );
433  else
434  return css::uno::Any();
435 }
465 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
466  class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
467  class Interface11, class Interface12 >
468 inline css::uno::Any SAL_CALL queryInterface(
469  const css::uno::Type & rType,
470  Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
471  Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
472  Interface11 * p11, Interface12 * p12 )
473 {
474  if (rType == Interface1::static_type())
475  return css::uno::Any( &p1, rType );
476  else if (rType == Interface2::static_type())
477  return css::uno::Any( &p2, rType );
478  else if (rType == Interface3::static_type())
479  return css::uno::Any( &p3, rType );
480  else if (rType == Interface4::static_type())
481  return css::uno::Any( &p4, rType );
482  else if (rType == Interface5::static_type())
483  return css::uno::Any( &p5, rType );
484  else if (rType == Interface6::static_type())
485  return css::uno::Any( &p6, rType );
486  else if (rType == Interface7::static_type())
487  return css::uno::Any( &p7, rType );
488  else if (rType == Interface8::static_type())
489  return css::uno::Any( &p8, rType );
490  else if (rType == Interface9::static_type())
491  return css::uno::Any( &p9, rType );
492  else if (rType == Interface10::static_type())
493  return css::uno::Any( &p10, rType );
494  else if (rType == Interface11::static_type())
495  return css::uno::Any( &p11, rType );
496  else if (rType == Interface12::static_type())
497  return css::uno::Any( &p12, rType );
498  else
499  return css::uno::Any();
500 }
501 
502 }
503 
504 #endif
505 
506 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:23