Kaydet (Commit) 39ce314c authored tarafından Stephan Bergmann's avatar Stephan Bergmann

comphelper::isA(Type... -> Type == cppu::UnoType...

Change-Id: I1bfb99b1715a907a03af5a30df6c7a41f91fd2fb
üst 884e970b
...@@ -289,7 +289,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -289,7 +289,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
break; break;
} }
case TypeClass_STRUCT: case TypeClass_STRUCT:
if (isA(_rType, static_cast<FontDescriptor*>(NULL))) if (_rType == cppu::UnoType<FontDescriptor>::get())
{ {
FontDescriptor aTemp; FontDescriptor aTemp;
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
...@@ -301,19 +301,19 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -301,19 +301,19 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
bRes = false; bRes = false;
break; break;
} }
if (isA(_rType, static_cast<Date*>(NULL))) if (_rType == cppu::UnoType<Date>::get())
{ {
Date aDummy; Date aDummy;
bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy); bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
break; break;
} }
if (isA(_rType, static_cast<Time*>(NULL))) if (_rType == cppu::UnoType<Time>::get())
{ {
Time aDummy; Time aDummy;
bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy); bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
break; break;
} }
if (isA(_rType, static_cast<DateTime*>(NULL))) if (_rType == cppu::UnoType<DateTime>::get())
{ {
DateTime aDummy; DateTime aDummy;
bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy); bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
...@@ -321,7 +321,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -321,7 +321,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
} }
break; break;
case TypeClass_SEQUENCE: case TypeClass_SEQUENCE:
if (isA(_rType, static_cast< Sequence<sal_Int8>* >(NULL))) if (_rType == cppu::UnoType<Sequence<sal_Int8>>::get())
{ {
Sequence<sal_Int8> aTemp; Sequence<sal_Int8> aTemp;
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
...@@ -333,7 +333,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -333,7 +333,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()) == 0;
} }
} }
else if (isA(_rType, static_cast< Sequence<sal_uInt8>* >(NULL))) else if (_rType == cppu::UnoType<Sequence<sal_uInt8>>::get())
{ {
Sequence<sal_uInt8> aTemp; Sequence<sal_uInt8> aTemp;
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
...@@ -345,7 +345,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -345,7 +345,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()) == 0;
} }
} }
else if (isA(_rType, static_cast< Sequence<sal_Int16>* >(NULL))) else if (_rType == cppu::UnoType<Sequence<sal_Int16>>::get())
{ {
Sequence<sal_Int16> aTemp; Sequence<sal_Int16> aTemp;
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
...@@ -357,7 +357,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -357,7 +357,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_Int16)) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_Int16)) == 0;
} }
} }
else if (isA(_rType, static_cast< Sequence<sal_uInt16>* >(NULL))) else if (_rType == cppu::UnoType<cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>::get())
{ {
Sequence<sal_uInt16> aTemp; Sequence<sal_uInt16> aTemp;
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
...@@ -369,7 +369,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -369,7 +369,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_uInt16)) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_uInt16)) == 0;
} }
} }
else if (isA(_rType, static_cast< Sequence<sal_Int32>* >(NULL))) else if (_rType == cppu::UnoType<Sequence<sal_Int32>>::get())
{ {
Sequence<sal_Int32> aTemp; Sequence<sal_Int32> aTemp;
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
...@@ -381,7 +381,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -381,7 +381,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_Int32)) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_Int32)) == 0;
} }
} }
else if (isA(_rType, static_cast< Sequence<sal_uInt32>* >(NULL))) else if (_rType == cppu::UnoType<Sequence<sal_uInt32>>::get())
{ {
Sequence<sal_uInt32> aTemp; Sequence<sal_uInt32> aTemp;
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
...@@ -393,7 +393,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) ...@@ -393,7 +393,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_uInt32)) == 0; memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_uInt32)) == 0;
} }
} }
else if (isA(_rType, static_cast< Sequence< OUString >* >(NULL))) else if (_rType == cppu::UnoType<Sequence<OUString>>::get())
{ {
Sequence< OUString > aTemp; Sequence< OUString > aTemp;
bConversionSuccess = _rValue >>= aTemp; bConversionSuccess = _rValue >>= aTemp;
......
...@@ -55,20 +55,6 @@ namespace comphelper ...@@ -55,20 +55,6 @@ namespace comphelper
/// returns sal_True if objects of the types given are "compatible" /// returns sal_True if objects of the types given are "compatible"
COMPHELPER_DLLPUBLIC bool isAssignableFrom(const css::uno::Type& _rAssignable, const css::uno::Type& _rFrom); COMPHELPER_DLLPUBLIC bool isAssignableFrom(const css::uno::Type& _rAssignable, const css::uno::Type& _rFrom);
/** just a small shortcut ...
check if a type you have at hand at runtime is equal to another type you have at compile time
if all our compiler would accept function calls with explicit template arguments (like
isA<classFoo>(runtimeType)), we wouldn't need the second parameter. But unfortunately at
least the current solaris compiler doesn't allow this ....
So this function is nearly senseless ....
*/
template <class TYPE>
bool isA(const css::uno::Type& _rType, TYPE* pDummy)
{
return _rType.equals(cppu::getTypeFavourUnsigned(pDummy));
}
/** ask the given object for an XComponent interface and dispose on it /** ask the given object for an XComponent interface and dispose on it
*/ */
template <class TYPE> template <class TYPE>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment