Prefer cppu::UnoType<T>::get() to ::getCppuType((T*)0) part4

Change-Id: I8e52c2fd66f8f3291434ee82a745431e11b12caf
This commit is contained in:
Julien Nabet
2014-05-06 23:25:13 +02:00
parent 127a5f5e12
commit 21010f3ea7
5 changed files with 30 additions and 30 deletions

View File

@@ -1508,24 +1508,24 @@ bool implUpdateObject(const Reference< XRowUpdate >& _rxUpdatedObject,
break; break;
case TypeClass_SEQUENCE: case TypeClass_SEQUENCE:
if (_rValue.getValueType() == ::getCppuType((const Sequence< sal_Int8 > *)0)) if (_rValue.getValueType() == cppu::UnoType< Sequence< sal_Int8 > >::get())
_rxUpdatedObject->updateBytes(_nColumnIndex, *(Sequence<sal_Int8>*)_rValue.getValue()); _rxUpdatedObject->updateBytes(_nColumnIndex, *(Sequence<sal_Int8>*)_rValue.getValue());
else else
bSuccessfullyReRouted = false; bSuccessfullyReRouted = false;
break; break;
case TypeClass_STRUCT: case TypeClass_STRUCT:
if (_rValue.getValueType() == ::getCppuType((const DateTime*)0)) if (_rValue.getValueType() == cppu::UnoType<DateTime>::get())
_rxUpdatedObject->updateTimestamp(_nColumnIndex, *(DateTime*)_rValue.getValue()); _rxUpdatedObject->updateTimestamp(_nColumnIndex, *(DateTime*)_rValue.getValue());
else if (_rValue.getValueType() == ::getCppuType((const Date*)0)) else if (_rValue.getValueType() == cppu::UnoType<Date>::get())
_rxUpdatedObject->updateDate(_nColumnIndex, *(Date*)_rValue.getValue()); _rxUpdatedObject->updateDate(_nColumnIndex, *(Date*)_rValue.getValue());
else if (_rValue.getValueType() == ::getCppuType((const Time*)0)) else if (_rValue.getValueType() == cppu::UnoType<Time>::get())
_rxUpdatedObject->updateTime(_nColumnIndex, *(Time*)_rValue.getValue()); _rxUpdatedObject->updateTime(_nColumnIndex, *(Time*)_rValue.getValue());
else else
bSuccessfullyReRouted = false; bSuccessfullyReRouted = false;
break; break;
case TypeClass_INTERFACE: case TypeClass_INTERFACE:
if (_rValue.getValueType() == ::getCppuType(static_cast<Reference< XInputStream>*>(NULL))) if (_rValue.getValueType() == cppu::UnoType<Reference< XInputStream> >::get())
{ {
Reference< XInputStream > xStream; Reference< XInputStream > xStream;
_rValue >>= xStream; _rValue >>= xStream;
@@ -1613,7 +1613,7 @@ bool implSetObject( const Reference< XParameters >& _rxParameters,
break; break;
case TypeClass_SEQUENCE: case TypeClass_SEQUENCE:
if (_rValue.getValueType() == ::getCppuType((const Sequence< sal_Int8 > *)0)) if (_rValue.getValueType() == cppu::UnoType< Sequence< sal_Int8 > >::get())
{ {
_rxParameters->setBytes(_nColumnIndex, *(Sequence<sal_Int8>*)_rValue.getValue()); _rxParameters->setBytes(_nColumnIndex, *(Sequence<sal_Int8>*)_rValue.getValue());
} }
@@ -1621,18 +1621,18 @@ bool implSetObject( const Reference< XParameters >& _rxParameters,
bSuccessfullyReRouted = false; bSuccessfullyReRouted = false;
break; break;
case TypeClass_STRUCT: case TypeClass_STRUCT:
if (_rValue.getValueType() == ::getCppuType((const DateTime*)0)) if (_rValue.getValueType() == cppu::UnoType<DateTime>::get())
_rxParameters->setTimestamp(_nColumnIndex, *(DateTime*)_rValue.getValue()); _rxParameters->setTimestamp(_nColumnIndex, *(DateTime*)_rValue.getValue());
else if (_rValue.getValueType() == ::getCppuType((const Date*)0)) else if (_rValue.getValueType() == cppu::UnoType<Date>::get())
_rxParameters->setDate(_nColumnIndex, *(Date*)_rValue.getValue()); _rxParameters->setDate(_nColumnIndex, *(Date*)_rValue.getValue());
else if (_rValue.getValueType() == ::getCppuType((const Time*)0)) else if (_rValue.getValueType() == cppu::UnoType<Time>::get())
_rxParameters->setTime(_nColumnIndex, *(Time*)_rValue.getValue()); _rxParameters->setTime(_nColumnIndex, *(Time*)_rValue.getValue());
else else
bSuccessfullyReRouted = false; bSuccessfullyReRouted = false;
break; break;
case TypeClass_INTERFACE: case TypeClass_INTERFACE:
if (_rValue.getValueType() == ::getCppuType(static_cast<Reference< XInputStream>*>(NULL))) if (_rValue.getValueType() == cppu::UnoType<Reference< XInputStream> >::get())
{ {
Reference< XInputStream > xStream; Reference< XInputStream > xStream;
_rValue >>= xStream; _rValue >>= xStream;

View File

@@ -441,7 +441,7 @@ bool StringRepresentation::convertGenericValueToString( const uno::Any& _rValue,
// some structs // some structs
case uno::TypeClass_STRUCT: case uno::TypeClass_STRUCT:
OSL_FAIL( "StringRepresentation::convertGenericValueToString(STRUCT): this is dead code - isn't it?" ); OSL_FAIL( "StringRepresentation::convertGenericValueToString(STRUCT): this is dead code - isn't it?" );
if ( _rValue.getValueType().equals( ::getCppuType( static_cast< util::Date* >( NULL ) ) ) ) if ( _rValue.getValueType().equals( cppu::UnoType< util::Date >::get() ))
{ {
// weird enough, the string representation of dates, as used // weird enough, the string representation of dates, as used
// by the control displaying dates, and thus as passed through the layers, // by the control displaying dates, and thus as passed through the layers,
@@ -450,14 +450,14 @@ bool StringRepresentation::convertGenericValueToString( const uno::Any& _rValue,
_rValue >>= aUnoDate; _rValue >>= aUnoDate;
_rStringRep = ::dbtools::DBTypeConversion::toDateString(aUnoDate); _rStringRep = ::dbtools::DBTypeConversion::toDateString(aUnoDate);
} }
else if ( _rValue.getValueType().equals( ::getCppuType( static_cast< util::Time* >( NULL ) ) ) ) else if ( _rValue.getValueType().equals( cppu::UnoType< util::Time >::get() ))
{ {
// similar for time (HHMMSSHH) // similar for time (HHMMSSHH)
util::Time aUnoTime; util::Time aUnoTime;
_rValue >>= aUnoTime; _rValue >>= aUnoTime;
_rStringRep = ::dbtools::DBTypeConversion::toTimeString(aUnoTime); _rStringRep = ::dbtools::DBTypeConversion::toTimeString(aUnoTime);
} }
else if ( _rValue.getValueType().equals( ::getCppuType( static_cast< util::DateTime* >( NULL ) ) ) ) else if ( _rValue.getValueType().equals( cppu::UnoType< util::DateTime >::get() ))
{ {
util::DateTime aUnoDateTime; util::DateTime aUnoDateTime;
_rValue >>= aUnoDateTime; _rValue >>= aUnoDateTime;
@@ -582,7 +582,7 @@ bool StringRepresentation::convertStringToGenericValue( const OUString& _rString
case uno::TypeClass_STRUCT: case uno::TypeClass_STRUCT:
OSL_FAIL( "StringRepresentation::convertStringToGenericValue(STRUCT): this is dead code - isn't it?" ); OSL_FAIL( "StringRepresentation::convertStringToGenericValue(STRUCT): this is dead code - isn't it?" );
if ( _rTargetType.equals( ::getCppuType( static_cast< util::Date* >( NULL ) ) ) ) if ( _rTargetType.equals( cppu::UnoType< util::Date >::get() ))
{ {
// weird enough, the string representation of dates, as used // weird enough, the string representation of dates, as used
// by the control displaying dates, and thus as passed through the layers, // by the control displaying dates, and thus as passed through the layers,
@@ -590,12 +590,12 @@ bool StringRepresentation::convertStringToGenericValue( const OUString& _rString
_rValue <<= ::dbtools::DBTypeConversion::toDate(_rStringRep); _rValue <<= ::dbtools::DBTypeConversion::toDate(_rStringRep);
} }
else if ( _rTargetType.equals( ::getCppuType( static_cast< util::Time* >( NULL ) ) ) ) else if ( _rTargetType.equals( cppu::UnoType< util::Time >::get() ))
{ {
// similar for time (HHMMSSHH) // similar for time (HHMMSSHH)
_rValue <<= ::dbtools::DBTypeConversion::toTime(_rStringRep); _rValue <<= ::dbtools::DBTypeConversion::toTime(_rStringRep);
} }
else if ( _rTargetType.equals( ::getCppuType( static_cast< util::DateTime* >( NULL ) ) ) ) else if ( _rTargetType.equals( cppu::UnoType< util::DateTime >::get() ))
{ {
_rValue <<= ::dbtools::DBTypeConversion::toDateTime(_rStringRep); _rValue <<= ::dbtools::DBTypeConversion::toDateTime(_rStringRep);
} }

View File

@@ -223,7 +223,7 @@ namespace sd
{ {
if( rValue.hasValue() ) try if( rValue.hasValue() ) try
{ {
if( rValue.getValueType() == ::getCppuType((const ValuePair*)0) ) if( rValue.getValueType() == cppu::UnoType<ValuePair>::get() )
{ {
ValuePair aValuePair; ValuePair aValuePair;
rValue >>= aValuePair; rValue >>= aValuePair;
@@ -233,7 +233,7 @@ namespace sd
return makeAny( aValuePair ); return makeAny( aValuePair );
} }
else if( rValue.getValueType() == ::getCppuType((Sequence<Any>*)0) ) else if( rValue.getValueType() == cppu::UnoType< Sequence<Any> >::get() )
{ {
Sequence<Any> aSequence; Sequence<Any> aSequence;
rValue >>= aSequence; rValue >>= aSequence;
@@ -263,7 +263,7 @@ namespace sd
return makeAny( getClonedNode( xNode ) ); return makeAny( getClonedNode( xNode ) );
} }
} }
else if( rValue.getValueType() == ::getCppuType((const ParagraphTarget*)0) ) else if( rValue.getValueType() == cppu::UnoType<ParagraphTarget>::get() )
{ {
ParagraphTarget aParaTarget; ParagraphTarget aParaTarget;
rValue >>= aParaTarget; rValue >>= aParaTarget;
@@ -272,7 +272,7 @@ namespace sd
return makeAny( aParaTarget ); return makeAny( aParaTarget );
} }
else if( rValue.getValueType() == ::getCppuType((const Event*)0) ) else if( rValue.getValueType() == cppu::UnoType<Event>::get() )
{ {
Event aEvent; Event aEvent;
rValue >>= aEvent; rValue >>= aEvent;

View File

@@ -839,7 +839,7 @@ bool AnimationImporter::convertAnimationValue( MS_AttributeNames eAttribute, Any
{ {
OUString aString; OUString aString;
if( rValue.getValueType() == ::getCppuType((const ValuePair*)0) ) if( rValue.getValueType() == cppu::UnoType<ValuePair>::get() )
{ {
ValuePair aValuePair; ValuePair aValuePair;
if( rValue >>= aValuePair ) if( rValue >>= aValuePair )
@@ -863,7 +863,7 @@ bool AnimationImporter::convertAnimationValue( MS_AttributeNames eAttribute, Any
} }
} }
} }
else if( rValue.getValueType() == ::getCppuType((const OUString*)0) ) else if( rValue.getValueType() == cppu::UnoType<OUString>::get() )
{ {
if( rValue >>= aString ) if( rValue >>= aString )
{ {
@@ -890,14 +890,14 @@ bool AnimationImporter::convertAnimationValue( MS_AttributeNames eAttribute, Any
case MS_STYLEROTATION: case MS_STYLEROTATION:
{ {
if( rValue.getValueType() == ::getCppuType((const OUString*)0) ) if( rValue.getValueType() == cppu::UnoType<OUString>::get() )
{ {
OUString aString; OUString aString;
rValue >>= aString; rValue >>= aString;
rValue <<= (sal_Int16)aString.toDouble(); rValue <<= (sal_Int16)aString.toDouble();
bRet = true; bRet = true;
} }
else if( rValue.getValueType() == ::getCppuType((const double*)0) ) else if( rValue.getValueType() == cppu::UnoType<double>::get() )
{ {
double fValue = 0.0; double fValue = 0.0;
rValue >>= fValue; rValue >>= fValue;
@@ -2683,7 +2683,7 @@ void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Referen
bool bHasValue = aValue2.hasValue(); bool bHasValue = aValue2.hasValue();
if( bHasValue ) if( bHasValue )
{ {
if( aValue2.getValueType() == ::getCppuType((const OUString*)0) ) if( aValue2.getValueType() == cppu::UnoType<OUString>::get() )
{ {
OUString aTest; OUString aTest;
aValue2 >>= aTest; aValue2 >>= aTest;
@@ -2692,7 +2692,7 @@ void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Referen
} }
} }
if( bHasValue && bCouldBeFormula && (aValue1.getValueType() == ::getCppuType((const double*)0)) ) if( bHasValue && bCouldBeFormula && (aValue1.getValueType() == cppu::UnoType<double>::get() ))
{ {
aValue2 >>= aFormula; aValue2 >>= aFormula;
bHasValue = false; bHasValue = false;

View File

@@ -141,25 +141,25 @@ void SAL_CALL SfxUnoControllerItem::statusChanged(const ::com::sun::star::frame:
eState = SFX_ITEM_AVAILABLE; eState = SFX_ITEM_AVAILABLE;
::com::sun::star::uno::Type pType = rEvent.State.getValueType(); ::com::sun::star::uno::Type pType = rEvent.State.getValueType();
if ( pType == ::getBooleanCppuType() ) if ( pType == cppu::UnoType< bool >::get() )
{ {
bool bTemp = false; bool bTemp = false;
rEvent.State >>= bTemp ; rEvent.State >>= bTemp ;
pItem = new SfxBoolItem( pCtrlItem->GetId(), bTemp ); pItem = new SfxBoolItem( pCtrlItem->GetId(), bTemp );
} }
else if ( pType == ::getCppuType((const sal_uInt16*)0) ) else if ( pType == cppu::UnoType< ::cppu::UnoUnsignedShortType >::get() )
{ {
sal_uInt16 nTemp = 0; sal_uInt16 nTemp = 0;
rEvent.State >>= nTemp ; rEvent.State >>= nTemp ;
pItem = new SfxUInt16Item( pCtrlItem->GetId(), nTemp ); pItem = new SfxUInt16Item( pCtrlItem->GetId(), nTemp );
} }
else if ( pType == ::getCppuType((const sal_uInt32*)0) ) else if ( pType == cppu::UnoType<sal_uInt32>::get() )
{ {
sal_uInt32 nTemp = 0; sal_uInt32 nTemp = 0;
rEvent.State >>= nTemp ; rEvent.State >>= nTemp ;
pItem = new SfxUInt32Item( pCtrlItem->GetId(), nTemp ); pItem = new SfxUInt32Item( pCtrlItem->GetId(), nTemp );
} }
else if ( pType == ::getCppuType((const OUString*)0) ) else if ( pType == cppu::UnoType<OUString>::get() )
{ {
OUString sTemp ; OUString sTemp ;
rEvent.State >>= sTemp ; rEvent.State >>= sTemp ;