UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 00029 #ifndef _CPPUHELPER_QUERYINTERFACE_HXX_ 00030 #define _CPPUHELPER_QUERYINTERFACE_HXX_ 00031 00032 #include "sal/config.h" 00033 #include "com/sun/star/uno/Any.hxx" 00034 #include "com/sun/star/uno/Type.hxx" 00035 #include "sal/types.h" 00036 00037 namespace cppu 00038 { 00039 00047 template< class Interface1 > 00048 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00049 const ::com::sun::star::uno::Type & rType, 00050 Interface1 * p1 ) 00051 SAL_THROW(()) 00052 { 00053 if (rType == Interface1::static_type()) 00054 return ::com::sun::star::uno::Any( &p1, rType ); 00055 else 00056 return ::com::sun::star::uno::Any(); 00057 } 00067 template< class Interface1, class Interface2 > 00068 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00069 const ::com::sun::star::uno::Type & rType, 00070 Interface1 * p1, Interface2 * p2 ) 00071 SAL_THROW(()) 00072 { 00073 if (rType == Interface1::static_type()) 00074 return ::com::sun::star::uno::Any( &p1, rType ); 00075 else if (rType == Interface2::static_type()) 00076 return ::com::sun::star::uno::Any( &p2, rType ); 00077 else 00078 return ::com::sun::star::uno::Any(); 00079 } 00091 template< class Interface1, class Interface2, class Interface3 > 00092 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00093 const ::com::sun::star::uno::Type & rType, 00094 Interface1 * p1, Interface2 * p2, Interface3 * p3 ) 00095 SAL_THROW(()) 00096 { 00097 if (rType == Interface1::static_type()) 00098 return ::com::sun::star::uno::Any( &p1, rType ); 00099 else if (rType == Interface2::static_type()) 00100 return ::com::sun::star::uno::Any( &p2, rType ); 00101 else if (rType == Interface3::static_type()) 00102 return ::com::sun::star::uno::Any( &p3, rType ); 00103 else 00104 return ::com::sun::star::uno::Any(); 00105 } 00119 template< class Interface1, class Interface2, class Interface3, class Interface4 > 00120 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00121 const ::com::sun::star::uno::Type & rType, 00122 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4 ) 00123 SAL_THROW(()) 00124 { 00125 if (rType == Interface1::static_type()) 00126 return ::com::sun::star::uno::Any( &p1, rType ); 00127 else if (rType == Interface2::static_type()) 00128 return ::com::sun::star::uno::Any( &p2, rType ); 00129 else if (rType == Interface3::static_type()) 00130 return ::com::sun::star::uno::Any( &p3, rType ); 00131 else if (rType == Interface4::static_type()) 00132 return ::com::sun::star::uno::Any( &p4, rType ); 00133 else 00134 return ::com::sun::star::uno::Any(); 00135 } 00151 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5 > 00152 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00153 const ::com::sun::star::uno::Type & rType, 00154 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5 ) 00155 SAL_THROW(()) 00156 { 00157 if (rType == Interface1::static_type()) 00158 return ::com::sun::star::uno::Any( &p1, rType ); 00159 else if (rType == Interface2::static_type()) 00160 return ::com::sun::star::uno::Any( &p2, rType ); 00161 else if (rType == Interface3::static_type()) 00162 return ::com::sun::star::uno::Any( &p3, rType ); 00163 else if (rType == Interface4::static_type()) 00164 return ::com::sun::star::uno::Any( &p4, rType ); 00165 else if (rType == Interface5::static_type()) 00166 return ::com::sun::star::uno::Any( &p5, rType ); 00167 else 00168 return ::com::sun::star::uno::Any(); 00169 } 00187 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, 00188 class Interface6 > 00189 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00190 const ::com::sun::star::uno::Type & rType, 00191 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, 00192 Interface6 * p6 ) 00193 SAL_THROW(()) 00194 { 00195 if (rType == Interface1::static_type()) 00196 return ::com::sun::star::uno::Any( &p1, rType ); 00197 else if (rType == Interface2::static_type()) 00198 return ::com::sun::star::uno::Any( &p2, rType ); 00199 else if (rType == Interface3::static_type()) 00200 return ::com::sun::star::uno::Any( &p3, rType ); 00201 else if (rType == Interface4::static_type()) 00202 return ::com::sun::star::uno::Any( &p4, rType ); 00203 else if (rType == Interface5::static_type()) 00204 return ::com::sun::star::uno::Any( &p5, rType ); 00205 else if (rType == Interface6::static_type()) 00206 return ::com::sun::star::uno::Any( &p6, rType ); 00207 else 00208 return ::com::sun::star::uno::Any(); 00209 } 00229 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, 00230 class Interface6, class Interface7 > 00231 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00232 const ::com::sun::star::uno::Type & rType, 00233 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, 00234 Interface6 * p6, Interface7 * p7 ) 00235 SAL_THROW(()) 00236 { 00237 if (rType == Interface1::static_type()) 00238 return ::com::sun::star::uno::Any( &p1, rType ); 00239 else if (rType == Interface2::static_type()) 00240 return ::com::sun::star::uno::Any( &p2, rType ); 00241 else if (rType == Interface3::static_type()) 00242 return ::com::sun::star::uno::Any( &p3, rType ); 00243 else if (rType == Interface4::static_type()) 00244 return ::com::sun::star::uno::Any( &p4, rType ); 00245 else if (rType == Interface5::static_type()) 00246 return ::com::sun::star::uno::Any( &p5, rType ); 00247 else if (rType == Interface6::static_type()) 00248 return ::com::sun::star::uno::Any( &p6, rType ); 00249 else if (rType == Interface7::static_type()) 00250 return ::com::sun::star::uno::Any( &p7, rType ); 00251 else 00252 return ::com::sun::star::uno::Any(); 00253 } 00275 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, 00276 class Interface6, class Interface7, class Interface8 > 00277 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00278 const ::com::sun::star::uno::Type & rType, 00279 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, 00280 Interface6 * p6, Interface7 * p7, Interface8 * p8 ) 00281 SAL_THROW(()) 00282 { 00283 if (rType == Interface1::static_type()) 00284 return ::com::sun::star::uno::Any( &p1, rType ); 00285 else if (rType == Interface2::static_type()) 00286 return ::com::sun::star::uno::Any( &p2, rType ); 00287 else if (rType == Interface3::static_type()) 00288 return ::com::sun::star::uno::Any( &p3, rType ); 00289 else if (rType == Interface4::static_type()) 00290 return ::com::sun::star::uno::Any( &p4, rType ); 00291 else if (rType == Interface5::static_type()) 00292 return ::com::sun::star::uno::Any( &p5, rType ); 00293 else if (rType == Interface6::static_type()) 00294 return ::com::sun::star::uno::Any( &p6, rType ); 00295 else if (rType == Interface7::static_type()) 00296 return ::com::sun::star::uno::Any( &p7, rType ); 00297 else if (rType == Interface8::static_type()) 00298 return ::com::sun::star::uno::Any( &p8, rType ); 00299 else 00300 return ::com::sun::star::uno::Any(); 00301 } 00325 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, 00326 class Interface6, class Interface7, class Interface8, class Interface9 > 00327 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00328 const ::com::sun::star::uno::Type & rType, 00329 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, 00330 Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9 ) 00331 SAL_THROW(()) 00332 { 00333 if (rType == Interface1::static_type()) 00334 return ::com::sun::star::uno::Any( &p1, rType ); 00335 else if (rType == Interface2::static_type()) 00336 return ::com::sun::star::uno::Any( &p2, rType ); 00337 else if (rType == Interface3::static_type()) 00338 return ::com::sun::star::uno::Any( &p3, rType ); 00339 else if (rType == Interface4::static_type()) 00340 return ::com::sun::star::uno::Any( &p4, rType ); 00341 else if (rType == Interface5::static_type()) 00342 return ::com::sun::star::uno::Any( &p5, rType ); 00343 else if (rType == Interface6::static_type()) 00344 return ::com::sun::star::uno::Any( &p6, rType ); 00345 else if (rType == Interface7::static_type()) 00346 return ::com::sun::star::uno::Any( &p7, rType ); 00347 else if (rType == Interface8::static_type()) 00348 return ::com::sun::star::uno::Any( &p8, rType ); 00349 else if (rType == Interface9::static_type()) 00350 return ::com::sun::star::uno::Any( &p9, rType ); 00351 else 00352 return ::com::sun::star::uno::Any(); 00353 } 00379 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, 00380 class Interface6, class Interface7, class Interface8, class Interface9, class Interface10 > 00381 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00382 const ::com::sun::star::uno::Type & rType, 00383 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, 00384 Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10 ) 00385 SAL_THROW(()) 00386 { 00387 if (rType == Interface1::static_type()) 00388 return ::com::sun::star::uno::Any( &p1, rType ); 00389 else if (rType == Interface2::static_type()) 00390 return ::com::sun::star::uno::Any( &p2, rType ); 00391 else if (rType == Interface3::static_type()) 00392 return ::com::sun::star::uno::Any( &p3, rType ); 00393 else if (rType == Interface4::static_type()) 00394 return ::com::sun::star::uno::Any( &p4, rType ); 00395 else if (rType == Interface5::static_type()) 00396 return ::com::sun::star::uno::Any( &p5, rType ); 00397 else if (rType == Interface6::static_type()) 00398 return ::com::sun::star::uno::Any( &p6, rType ); 00399 else if (rType == Interface7::static_type()) 00400 return ::com::sun::star::uno::Any( &p7, rType ); 00401 else if (rType == Interface8::static_type()) 00402 return ::com::sun::star::uno::Any( &p8, rType ); 00403 else if (rType == Interface9::static_type()) 00404 return ::com::sun::star::uno::Any( &p9, rType ); 00405 else if (rType == Interface10::static_type()) 00406 return ::com::sun::star::uno::Any( &p10, rType ); 00407 else 00408 return ::com::sun::star::uno::Any(); 00409 } 00437 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, 00438 class Interface6, class Interface7, class Interface8, class Interface9, class Interface10, 00439 class Interface11 > 00440 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00441 const ::com::sun::star::uno::Type & rType, 00442 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, 00443 Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10, 00444 Interface11 * p11 ) 00445 SAL_THROW(()) 00446 { 00447 if (rType == Interface1::static_type()) 00448 return ::com::sun::star::uno::Any( &p1, rType ); 00449 else if (rType == Interface2::static_type()) 00450 return ::com::sun::star::uno::Any( &p2, rType ); 00451 else if (rType == Interface3::static_type()) 00452 return ::com::sun::star::uno::Any( &p3, rType ); 00453 else if (rType == Interface4::static_type()) 00454 return ::com::sun::star::uno::Any( &p4, rType ); 00455 else if (rType == Interface5::static_type()) 00456 return ::com::sun::star::uno::Any( &p5, rType ); 00457 else if (rType == Interface6::static_type()) 00458 return ::com::sun::star::uno::Any( &p6, rType ); 00459 else if (rType == Interface7::static_type()) 00460 return ::com::sun::star::uno::Any( &p7, rType ); 00461 else if (rType == Interface8::static_type()) 00462 return ::com::sun::star::uno::Any( &p8, rType ); 00463 else if (rType == Interface9::static_type()) 00464 return ::com::sun::star::uno::Any( &p9, rType ); 00465 else if (rType == Interface10::static_type()) 00466 return ::com::sun::star::uno::Any( &p10, rType ); 00467 else if (rType == Interface11::static_type()) 00468 return ::com::sun::star::uno::Any( &p11, rType ); 00469 else 00470 return ::com::sun::star::uno::Any(); 00471 } 00501 template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, 00502 class Interface6, class Interface7, class Interface8, class Interface9, class Interface10, 00503 class Interface11, class Interface12 > 00504 inline ::com::sun::star::uno::Any SAL_CALL queryInterface( 00505 const ::com::sun::star::uno::Type & rType, 00506 Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, 00507 Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10, 00508 Interface11 * p11, Interface12 * p12 ) 00509 SAL_THROW(()) 00510 { 00511 if (rType == Interface1::static_type()) 00512 return ::com::sun::star::uno::Any( &p1, rType ); 00513 else if (rType == Interface2::static_type()) 00514 return ::com::sun::star::uno::Any( &p2, rType ); 00515 else if (rType == Interface3::static_type()) 00516 return ::com::sun::star::uno::Any( &p3, rType ); 00517 else if (rType == Interface4::static_type()) 00518 return ::com::sun::star::uno::Any( &p4, rType ); 00519 else if (rType == Interface5::static_type()) 00520 return ::com::sun::star::uno::Any( &p5, rType ); 00521 else if (rType == Interface6::static_type()) 00522 return ::com::sun::star::uno::Any( &p6, rType ); 00523 else if (rType == Interface7::static_type()) 00524 return ::com::sun::star::uno::Any( &p7, rType ); 00525 else if (rType == Interface8::static_type()) 00526 return ::com::sun::star::uno::Any( &p8, rType ); 00527 else if (rType == Interface9::static_type()) 00528 return ::com::sun::star::uno::Any( &p9, rType ); 00529 else if (rType == Interface10::static_type()) 00530 return ::com::sun::star::uno::Any( &p10, rType ); 00531 else if (rType == Interface11::static_type()) 00532 return ::com::sun::star::uno::Any( &p11, rType ); 00533 else if (rType == Interface12::static_type()) 00534 return ::com::sun::star::uno::Any( &p12, rType ); 00535 else 00536 return ::com::sun::star::uno::Any(); 00537 } 00538 00539 } 00540 00541 #endif 00542 00543 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */