diff options
-rw-r--r-- | comphelper/source/misc/types.cxx | 22 | ||||
-rw-r--r-- | include/comphelper/types.hxx | 14 |
2 files changed, 11 insertions, 25 deletions
diff --git a/comphelper/source/misc/types.cxx b/comphelper/source/misc/types.cxx index e81a813a581d..06afb83e4b3c 100644 --- a/comphelper/source/misc/types.cxx +++ b/comphelper/source/misc/types.cxx @@ -289,7 +289,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) break; } case TypeClass_STRUCT: - if (isA(_rType, static_cast<FontDescriptor*>(NULL))) + if (_rType == cppu::UnoType<FontDescriptor>::get()) { FontDescriptor aTemp; bConversionSuccess = _rValue >>= aTemp; @@ -301,19 +301,19 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) bRes = false; break; } - if (isA(_rType, static_cast<Date*>(NULL))) + if (_rType == cppu::UnoType<Date>::get()) { Date aDummy; bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy); break; } - if (isA(_rType, static_cast<Time*>(NULL))) + if (_rType == cppu::UnoType<Time>::get()) { Time aDummy; bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy); break; } - if (isA(_rType, static_cast<DateTime*>(NULL))) + if (_rType == cppu::UnoType<DateTime>::get()) { DateTime aDummy; bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy); @@ -321,7 +321,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) } break; case TypeClass_SEQUENCE: - if (isA(_rType, static_cast< Sequence<sal_Int8>* >(NULL))) + if (_rType == cppu::UnoType<Sequence<sal_Int8>>::get()) { Sequence<sal_Int8> aTemp; bConversionSuccess = _rValue >>= aTemp; @@ -333,7 +333,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) 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; bConversionSuccess = _rValue >>= aTemp; @@ -345,7 +345,7 @@ bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue) 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; bConversionSuccess = _rValue >>= aTemp; @@ -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; } } - else if (isA(_rType, static_cast< Sequence<sal_uInt16>* >(NULL))) + else if (_rType == cppu::UnoType<cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>::get()) { Sequence<sal_uInt16> aTemp; bConversionSuccess = _rValue >>= aTemp; @@ -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; } } - else if (isA(_rType, static_cast< Sequence<sal_Int32>* >(NULL))) + else if (_rType == cppu::UnoType<Sequence<sal_Int32>>::get()) { Sequence<sal_Int32> aTemp; bConversionSuccess = _rValue >>= aTemp; @@ -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; } } - else if (isA(_rType, static_cast< Sequence<sal_uInt32>* >(NULL))) + else if (_rType == cppu::UnoType<Sequence<sal_uInt32>>::get()) { Sequence<sal_uInt32> aTemp; bConversionSuccess = _rValue >>= aTemp; @@ -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; } } - else if (isA(_rType, static_cast< Sequence< OUString >* >(NULL))) + else if (_rType == cppu::UnoType<Sequence<OUString>>::get()) { Sequence< OUString > aTemp; bConversionSuccess = _rValue >>= aTemp; diff --git a/include/comphelper/types.hxx b/include/comphelper/types.hxx index 142cee946d93..0e506f392afc 100644 --- a/include/comphelper/types.hxx +++ b/include/comphelper/types.hxx @@ -55,20 +55,6 @@ namespace comphelper /// 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); - - /** 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 */ template <class TYPE> |