00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
00021 #define _CPPUHELPER_QUERYINTERFACE_HXX_
00022
00023 #include "sal/config.h"
00024 #include "com/sun/star/uno/Any.hxx"
00025 #include "com/sun/star/uno/Type.hxx"
00026 #include "sal/types.h"
00027
00028 namespace cppu
00029 {
00030
00038 template< class Interface1 >
00039 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00040 const ::com::sun::star::uno::Type & rType,
00041 Interface1 * p1 )
00042 SAL_THROW(())
00043 {
00044 if (rType == Interface1::static_type())
00045 return ::com::sun::star::uno::Any( &p1, rType );
00046 else
00047 return ::com::sun::star::uno::Any();
00048 }
00058 template< class Interface1, class Interface2 >
00059 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00060 const ::com::sun::star::uno::Type & rType,
00061 Interface1 * p1, Interface2 * p2 )
00062 SAL_THROW(())
00063 {
00064 if (rType == Interface1::static_type())
00065 return ::com::sun::star::uno::Any( &p1, rType );
00066 else if (rType == Interface2::static_type())
00067 return ::com::sun::star::uno::Any( &p2, rType );
00068 else
00069 return ::com::sun::star::uno::Any();
00070 }
00082 template< class Interface1, class Interface2, class Interface3 >
00083 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00084 const ::com::sun::star::uno::Type & rType,
00085 Interface1 * p1, Interface2 * p2, Interface3 * p3 )
00086 SAL_THROW(())
00087 {
00088 if (rType == Interface1::static_type())
00089 return ::com::sun::star::uno::Any( &p1, rType );
00090 else if (rType == Interface2::static_type())
00091 return ::com::sun::star::uno::Any( &p2, rType );
00092 else if (rType == Interface3::static_type())
00093 return ::com::sun::star::uno::Any( &p3, rType );
00094 else
00095 return ::com::sun::star::uno::Any();
00096 }
00110 template< class Interface1, class Interface2, class Interface3, class Interface4 >
00111 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00112 const ::com::sun::star::uno::Type & rType,
00113 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4 )
00114 SAL_THROW(())
00115 {
00116 if (rType == Interface1::static_type())
00117 return ::com::sun::star::uno::Any( &p1, rType );
00118 else if (rType == Interface2::static_type())
00119 return ::com::sun::star::uno::Any( &p2, rType );
00120 else if (rType == Interface3::static_type())
00121 return ::com::sun::star::uno::Any( &p3, rType );
00122 else if (rType == Interface4::static_type())
00123 return ::com::sun::star::uno::Any( &p4, rType );
00124 else
00125 return ::com::sun::star::uno::Any();
00126 }
00142 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5 >
00143 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00144 const ::com::sun::star::uno::Type & rType,
00145 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5 )
00146 SAL_THROW(())
00147 {
00148 if (rType == Interface1::static_type())
00149 return ::com::sun::star::uno::Any( &p1, rType );
00150 else if (rType == Interface2::static_type())
00151 return ::com::sun::star::uno::Any( &p2, rType );
00152 else if (rType == Interface3::static_type())
00153 return ::com::sun::star::uno::Any( &p3, rType );
00154 else if (rType == Interface4::static_type())
00155 return ::com::sun::star::uno::Any( &p4, rType );
00156 else if (rType == Interface5::static_type())
00157 return ::com::sun::star::uno::Any( &p5, rType );
00158 else
00159 return ::com::sun::star::uno::Any();
00160 }
00178 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
00179 class Interface6 >
00180 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00181 const ::com::sun::star::uno::Type & rType,
00182 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
00183 Interface6 * p6 )
00184 SAL_THROW(())
00185 {
00186 if (rType == Interface1::static_type())
00187 return ::com::sun::star::uno::Any( &p1, rType );
00188 else if (rType == Interface2::static_type())
00189 return ::com::sun::star::uno::Any( &p2, rType );
00190 else if (rType == Interface3::static_type())
00191 return ::com::sun::star::uno::Any( &p3, rType );
00192 else if (rType == Interface4::static_type())
00193 return ::com::sun::star::uno::Any( &p4, rType );
00194 else if (rType == Interface5::static_type())
00195 return ::com::sun::star::uno::Any( &p5, rType );
00196 else if (rType == Interface6::static_type())
00197 return ::com::sun::star::uno::Any( &p6, rType );
00198 else
00199 return ::com::sun::star::uno::Any();
00200 }
00220 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
00221 class Interface6, class Interface7 >
00222 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00223 const ::com::sun::star::uno::Type & rType,
00224 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
00225 Interface6 * p6, Interface7 * p7 )
00226 SAL_THROW(())
00227 {
00228 if (rType == Interface1::static_type())
00229 return ::com::sun::star::uno::Any( &p1, rType );
00230 else if (rType == Interface2::static_type())
00231 return ::com::sun::star::uno::Any( &p2, rType );
00232 else if (rType == Interface3::static_type())
00233 return ::com::sun::star::uno::Any( &p3, rType );
00234 else if (rType == Interface4::static_type())
00235 return ::com::sun::star::uno::Any( &p4, rType );
00236 else if (rType == Interface5::static_type())
00237 return ::com::sun::star::uno::Any( &p5, rType );
00238 else if (rType == Interface6::static_type())
00239 return ::com::sun::star::uno::Any( &p6, rType );
00240 else if (rType == Interface7::static_type())
00241 return ::com::sun::star::uno::Any( &p7, rType );
00242 else
00243 return ::com::sun::star::uno::Any();
00244 }
00266 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
00267 class Interface6, class Interface7, class Interface8 >
00268 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00269 const ::com::sun::star::uno::Type & rType,
00270 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
00271 Interface6 * p6, Interface7 * p7, Interface8 * p8 )
00272 SAL_THROW(())
00273 {
00274 if (rType == Interface1::static_type())
00275 return ::com::sun::star::uno::Any( &p1, rType );
00276 else if (rType == Interface2::static_type())
00277 return ::com::sun::star::uno::Any( &p2, rType );
00278 else if (rType == Interface3::static_type())
00279 return ::com::sun::star::uno::Any( &p3, rType );
00280 else if (rType == Interface4::static_type())
00281 return ::com::sun::star::uno::Any( &p4, rType );
00282 else if (rType == Interface5::static_type())
00283 return ::com::sun::star::uno::Any( &p5, rType );
00284 else if (rType == Interface6::static_type())
00285 return ::com::sun::star::uno::Any( &p6, rType );
00286 else if (rType == Interface7::static_type())
00287 return ::com::sun::star::uno::Any( &p7, rType );
00288 else if (rType == Interface8::static_type())
00289 return ::com::sun::star::uno::Any( &p8, rType );
00290 else
00291 return ::com::sun::star::uno::Any();
00292 }
00316 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
00317 class Interface6, class Interface7, class Interface8, class Interface9 >
00318 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00319 const ::com::sun::star::uno::Type & rType,
00320 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
00321 Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9 )
00322 SAL_THROW(())
00323 {
00324 if (rType == Interface1::static_type())
00325 return ::com::sun::star::uno::Any( &p1, rType );
00326 else if (rType == Interface2::static_type())
00327 return ::com::sun::star::uno::Any( &p2, rType );
00328 else if (rType == Interface3::static_type())
00329 return ::com::sun::star::uno::Any( &p3, rType );
00330 else if (rType == Interface4::static_type())
00331 return ::com::sun::star::uno::Any( &p4, rType );
00332 else if (rType == Interface5::static_type())
00333 return ::com::sun::star::uno::Any( &p5, rType );
00334 else if (rType == Interface6::static_type())
00335 return ::com::sun::star::uno::Any( &p6, rType );
00336 else if (rType == Interface7::static_type())
00337 return ::com::sun::star::uno::Any( &p7, rType );
00338 else if (rType == Interface8::static_type())
00339 return ::com::sun::star::uno::Any( &p8, rType );
00340 else if (rType == Interface9::static_type())
00341 return ::com::sun::star::uno::Any( &p9, rType );
00342 else
00343 return ::com::sun::star::uno::Any();
00344 }
00370 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
00371 class Interface6, class Interface7, class Interface8, class Interface9, class Interface10 >
00372 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00373 const ::com::sun::star::uno::Type & rType,
00374 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
00375 Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10 )
00376 SAL_THROW(())
00377 {
00378 if (rType == Interface1::static_type())
00379 return ::com::sun::star::uno::Any( &p1, rType );
00380 else if (rType == Interface2::static_type())
00381 return ::com::sun::star::uno::Any( &p2, rType );
00382 else if (rType == Interface3::static_type())
00383 return ::com::sun::star::uno::Any( &p3, rType );
00384 else if (rType == Interface4::static_type())
00385 return ::com::sun::star::uno::Any( &p4, rType );
00386 else if (rType == Interface5::static_type())
00387 return ::com::sun::star::uno::Any( &p5, rType );
00388 else if (rType == Interface6::static_type())
00389 return ::com::sun::star::uno::Any( &p6, rType );
00390 else if (rType == Interface7::static_type())
00391 return ::com::sun::star::uno::Any( &p7, rType );
00392 else if (rType == Interface8::static_type())
00393 return ::com::sun::star::uno::Any( &p8, rType );
00394 else if (rType == Interface9::static_type())
00395 return ::com::sun::star::uno::Any( &p9, rType );
00396 else if (rType == Interface10::static_type())
00397 return ::com::sun::star::uno::Any( &p10, rType );
00398 else
00399 return ::com::sun::star::uno::Any();
00400 }
00428 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
00429 class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
00430 class Interface11 >
00431 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00432 const ::com::sun::star::uno::Type & rType,
00433 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
00434 Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
00435 Interface11 * p11 )
00436 SAL_THROW(())
00437 {
00438 if (rType == Interface1::static_type())
00439 return ::com::sun::star::uno::Any( &p1, rType );
00440 else if (rType == Interface2::static_type())
00441 return ::com::sun::star::uno::Any( &p2, rType );
00442 else if (rType == Interface3::static_type())
00443 return ::com::sun::star::uno::Any( &p3, rType );
00444 else if (rType == Interface4::static_type())
00445 return ::com::sun::star::uno::Any( &p4, rType );
00446 else if (rType == Interface5::static_type())
00447 return ::com::sun::star::uno::Any( &p5, rType );
00448 else if (rType == Interface6::static_type())
00449 return ::com::sun::star::uno::Any( &p6, rType );
00450 else if (rType == Interface7::static_type())
00451 return ::com::sun::star::uno::Any( &p7, rType );
00452 else if (rType == Interface8::static_type())
00453 return ::com::sun::star::uno::Any( &p8, rType );
00454 else if (rType == Interface9::static_type())
00455 return ::com::sun::star::uno::Any( &p9, rType );
00456 else if (rType == Interface10::static_type())
00457 return ::com::sun::star::uno::Any( &p10, rType );
00458 else if (rType == Interface11::static_type())
00459 return ::com::sun::star::uno::Any( &p11, rType );
00460 else
00461 return ::com::sun::star::uno::Any();
00462 }
00492 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
00493 class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
00494 class Interface11, class Interface12 >
00495 inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
00496 const ::com::sun::star::uno::Type & rType,
00497 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
00498 Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
00499 Interface11 * p11, Interface12 * p12 )
00500 SAL_THROW(())
00501 {
00502 if (rType == Interface1::static_type())
00503 return ::com::sun::star::uno::Any( &p1, rType );
00504 else if (rType == Interface2::static_type())
00505 return ::com::sun::star::uno::Any( &p2, rType );
00506 else if (rType == Interface3::static_type())
00507 return ::com::sun::star::uno::Any( &p3, rType );
00508 else if (rType == Interface4::static_type())
00509 return ::com::sun::star::uno::Any( &p4, rType );
00510 else if (rType == Interface5::static_type())
00511 return ::com::sun::star::uno::Any( &p5, rType );
00512 else if (rType == Interface6::static_type())
00513 return ::com::sun::star::uno::Any( &p6, rType );
00514 else if (rType == Interface7::static_type())
00515 return ::com::sun::star::uno::Any( &p7, rType );
00516 else if (rType == Interface8::static_type())
00517 return ::com::sun::star::uno::Any( &p8, rType );
00518 else if (rType == Interface9::static_type())
00519 return ::com::sun::star::uno::Any( &p9, rType );
00520 else if (rType == Interface10::static_type())
00521 return ::com::sun::star::uno::Any( &p10, rType );
00522 else if (rType == Interface11::static_type())
00523 return ::com::sun::star::uno::Any( &p11, rType );
00524 else if (rType == Interface12::static_type())
00525 return ::com::sun::star::uno::Any( &p12, rType );
00526 else
00527 return ::com::sun::star::uno::Any();
00528 }
00529
00530 }
00531
00532 #endif
00533
00534