simplify macros

Change-Id: Ib56bdc2f8a7015afc8ac83d7cfd6eb65089682bb
Reviewed-on: https://gerrit.libreoffice.org/31364
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2016-11-29 14:02:47 +02:00
parent 2833691149
commit 794c542953

View File

@@ -130,7 +130,7 @@ class PropertyValues : public std::vector< ucbhelper_impl::PropertyValue > {};
// Welcome to the macro hell... // Welcome to the macro hell...
#define GETVALUE_IMPL_TYPE( _type_, _type_name_, _member_name_, _cppu_type_ ) \ #define GETVALUE_IMPL( _type_, _type_name_, _member_name_ ) \
\ \
osl::MutexGuard aGuard( m_aMutex ); \ osl::MutexGuard aGuard( m_aMutex ); \
\ \
@@ -142,22 +142,22 @@ class PropertyValues : public std::vector< ucbhelper_impl::PropertyValue > {};
|| ( columnIndex > sal_Int32( m_pValues->size() ) ) ) \ || ( columnIndex > sal_Int32( m_pValues->size() ) ) ) \
{ \ { \
OSL_FAIL( "PropertyValueSet - index out of range!" ); \ OSL_FAIL( "PropertyValueSet - index out of range!" ); \
return aValue; \
} \ } \
else \
{ \
ucbhelper_impl::PropertyValue& rValue \ ucbhelper_impl::PropertyValue& rValue \
= (*m_pValues)[ columnIndex - 1 ]; \ = (*m_pValues)[ columnIndex - 1 ]; \
\ \
if ( rValue.nOrigValue != PropsSet::NONE ) \ if ( rValue.nOrigValue == PropsSet::NONE ) \
{ \ return aValue; \
\
if ( rValue.nPropsSet & _type_name_ ) \ if ( rValue.nPropsSet & _type_name_ ) \
{ \ { \
/* Values is present natively... */ \ /* Values is present natively... */ \
aValue = rValue._member_name_; \ aValue = rValue._member_name_; \
m_bWasNull = false; \ m_bWasNull = false; \
return aValue; \
} \ } \
else \ \
{ \
if ( !(rValue.nPropsSet & PropsSet::Object) ) \ if ( !(rValue.nPropsSet & PropsSet::Object) ) \
{ \ { \
/* Value is not (yet) available as Any. Create it. */ \ /* Value is not (yet) available as Any. Create it. */ \
@@ -189,7 +189,7 @@ class PropertyValues : public std::vector< ucbhelper_impl::PropertyValue > {};
{ \ { \
Any aConvAny = xConverter->convertTo( \ Any aConvAny = xConverter->convertTo( \
rValue.aObject, \ rValue.aObject, \
_cppu_type_ ); \ cppu::UnoType<_type_>::get() ); \
\ \
if ( aConvAny >>= aValue ) \ if ( aConvAny >>= aValue ) \
{ \ { \
@@ -208,17 +208,8 @@ class PropertyValues : public std::vector< ucbhelper_impl::PropertyValue > {};
} \ } \
} \ } \
} \ } \
} \
} \
} \
return aValue; return aValue;
#define GETVALUE_IMPL( _type_, _type_name_, _member_name_ ) \
GETVALUE_IMPL_TYPE( _type_, \
_type_name_, \
_member_name_, \
cppu::UnoType<_type_>::get() )
#define SETVALUE_IMPL( _prop_name_, _type_name_, _member_name_, _value_ ) \ #define SETVALUE_IMPL( _prop_name_, _type_name_, _member_name_, _value_ ) \
\ \
osl::MutexGuard aGuard( m_aMutex ); \ osl::MutexGuard aGuard( m_aMutex ); \
@@ -314,8 +305,7 @@ OUString SAL_CALL PropertyValueSet::getString( sal_Int32 columnIndex )
sal_Bool SAL_CALL PropertyValueSet::getBoolean( sal_Int32 columnIndex ) sal_Bool SAL_CALL PropertyValueSet::getBoolean( sal_Int32 columnIndex )
throw( SQLException, RuntimeException, std::exception ) throw( SQLException, RuntimeException, std::exception )
{ {
GETVALUE_IMPL_TYPE( GETVALUE_IMPL( bool, PropsSet::Boolean, bBoolean );
bool, PropsSet::Boolean, bBoolean, cppu::UnoType<bool>::get() );
} }