diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-05-31 08:47:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-05-31 08:47:05 +0200 |
commit | 6cf436799cb145c61f8324c074541950ee1a23e8 (patch) | |
tree | 342ea1fa627a99cf316bf483119727316f172010 /include/comphelper | |
parent | 59dbfecedb76ecf2ff8d464c144a0adf85eb3766 (diff) |
More comphelper/extract.hxx clean up
Change-Id: I36c1ebea58bcd32b65a48d3447c106aeecdac230
Diffstat (limited to 'include/comphelper')
-rw-r--r-- | include/comphelper/extract.hxx | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/include/comphelper/extract.hxx b/include/comphelper/extract.hxx index 2b5ae0a88dfc..36597f89d4a3 100644 --- a/include/comphelper/extract.hxx +++ b/include/comphelper/extract.hxx @@ -53,11 +53,11 @@ inline css::uno::Any SAL_CALL int2enum( * @param rAny enum or int * @param sal_True if enum or int value was set else sal_False. */ -inline bool SAL_CALL enum2int( sal_Int32 & rnEnum, const css::uno::Any & rAny ) +inline bool enum2int( sal_Int32 & rnEnum, const css::uno::Any & rAny ) { if (rAny.getValueTypeClass() == css::uno::TypeClass_ENUM) { - rnEnum = * static_cast< const int * >( rAny.getValue() ); + rnEnum = * static_cast< const sal_Int32 * >( rAny.getValue() ); return true; } @@ -72,7 +72,7 @@ inline bool SAL_CALL enum2int( sal_Int32 & rnEnum, const css::uno::Any & rAny ) * a css::lang::IllegalArgumentException is thrown */ template< typename E > -inline void SAL_CALL any2enum( E & eRet, const css::uno::Any & rAny ) +inline void any2enum( E & eRet, const css::uno::Any & rAny ) throw( css::lang::IllegalArgumentException ) { // check for typesafe enum @@ -88,29 +88,18 @@ inline void SAL_CALL any2enum( E & eRet, const css::uno::Any & rAny ) } /** - * Template function to create an uno::Any from an enum - * - * @DEPRECATED : use makeAny< E >() - * - */ -template< typename E > -inline css::uno::Any SAL_CALL enum2any( E eEnum ) -{ - return css::uno::Any( &eEnum, ::cppu::UnoType< E >::get() ); -} - -/** - * extracts a boolean either as a sal_Bool or an integer from - * an any. If there is no sal_Bool or integer inside the any + * extracts a boolean either as a bool or an integer from + * an any. If there is no bool or integer inside the any * a css::lang::IllegalArgumentException is thrown * */ -inline bool SAL_CALL any2bool( const css::uno::Any & rAny ) +inline bool any2bool( const css::uno::Any & rAny ) throw( css::lang::IllegalArgumentException ) { - if (rAny.getValueTypeClass() == css::uno::TypeClass_BOOLEAN) + bool b; + if (rAny >>= b) { - return *static_cast<sal_Bool const *>(rAny.getValue()); + return b; } else { |