summaryrefslogtreecommitdiff
path: root/comphelper/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-08-21 10:33:44 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-08-21 10:34:04 +0200
commitfe6c124da752c784c8c9578923a0033a77d3c5b3 (patch)
treeabecf6baf859612cd7255d13588ded9d204da690 /comphelper/source
parent5ff8f80a27b08ed6b3c12e354080c6ea1b90b6ee (diff)
Remove demonstrated-useless comphelper::compare
Change-Id: Ifd1b38afb963255b76f0d821eb46e4c6a972128a
Diffstat (limited to 'comphelper/source')
-rw-r--r--comphelper/source/misc/types.cxx284
1 files changed, 0 insertions, 284 deletions
diff --git a/comphelper/source/misc/types.cxx b/comphelper/source/misc/types.cxx
index 025000dcb911..9ae263cd549d 100644
--- a/comphelper/source/misc/types.cxx
+++ b/comphelper/source/misc/types.cxx
@@ -41,36 +41,6 @@ using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::lang;
-
-bool operator ==(const DateTime& _rLeft, const DateTime& _rRight)
-{
- return ( _rLeft.NanoSeconds == _rRight.NanoSeconds) &&
- ( _rLeft.Seconds == _rRight.Seconds) &&
- ( _rLeft.Minutes == _rRight.Minutes) &&
- ( _rLeft.Hours == _rRight.Hours) &&
- ( _rLeft.Day == _rRight.Day) &&
- ( _rLeft.Month == _rRight.Month) &&
- ( _rLeft.Year == _rRight.Year) ;
-}
-
-
-bool operator ==(const Date& _rLeft, const Date& _rRight)
-{
- return ( _rLeft.Day == _rRight.Day) &&
- ( _rLeft.Month == _rRight.Month) &&
- ( _rLeft.Year == _rRight.Year) ;
-}
-
-
-bool operator ==(const Time& _rLeft, const Time& _rRight)
-{
- return ( _rLeft.NanoSeconds == _rRight.NanoSeconds) &&
- ( _rLeft.Seconds == _rRight.Seconds) &&
- ( _rLeft.Minutes == _rRight.Minutes) &&
- ( _rLeft.Hours == _rRight.Hours) ;
-}
-
-
sal_Int64 getINT64(const Any& _rAny)
{
sal_Int64 nReturn = 0;
@@ -162,260 +132,6 @@ bool isAssignableFrom(const Type& _rAssignable, const Type& _rFrom)
return typelib_typedescription_isAssignableFrom(pAssignable, pFrom);
}
-
-template<class TYPE>
-bool tryCompare(const void* _pData, const Any& _rValue, bool& _bIdentical, TYPE& _rOut)
-{
- bool bSuccess = _rValue >>= _rOut;
- _bIdentical = bSuccess && (_rOut == *static_cast<const TYPE*>(_pData));
- return bSuccess;
-}
-
-
-bool tryCompare(const void* _pData, const Any& _rValue, bool& _bIdentical, sal_Unicode& _rOut)
-{
- bool bSuccess = ( _rValue.getValueTypeClass() == TypeClass_CHAR );
- if ( bSuccess )
- _rOut = *static_cast< const sal_Unicode* >( _rValue.getValue() );
- _bIdentical = bSuccess && ( _rOut == *static_cast< const sal_Unicode* >( _pData ) );
- return bSuccess;
-}
-
-
-bool compare_impl(const Type& _rType, const void* pData, const Any& _rValue)
-{
- bool bRes = true;
-
- if (_rType.getTypeClass() == TypeClass_ANY)
- {
- // beides AnyWerte
- if (_rValue.getValueType().getTypeClass() == TypeClass_ANY)
- bRes = compare_impl(
- static_cast<const Any*>(pData)->getValueType(),
- static_cast<const Any*>(pData)->getValue(),
- *static_cast<const Any*>(_rValue.getValue()));
- else
- bRes = compare_impl(
- static_cast<const Any*>(pData)->getValueType(),
- static_cast<const Any*>(pData)->getValue(),
- _rValue);
- }
- else if ( (_rType.getTypeClass() == TypeClass_VOID)
- || (_rValue.getValueType().getTypeClass() == TypeClass_VOID)
- )
- {
- bRes = _rType.getTypeClass() == _rValue.getValueType().getTypeClass();
- }
- else
- {
- bool bConversionSuccess = false;
- switch (_rType.getTypeClass())
- {
- case TypeClass_VOID:
- bConversionSuccess = true;
- bRes = _rValue.getValueType().getTypeClass() == TypeClass_VOID;
- break;
- case TypeClass_BOOLEAN:
- {
- bool aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_CHAR:
- {
- sal_Unicode aDummy(0);
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_STRING:
- {
- OUString aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_FLOAT:
- {
- float aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_DOUBLE:
- {
- double aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_BYTE:
- {
- sal_Int8 aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_SHORT:
- {
- sal_Int16 aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_ENUM:
- {
- sal_Int32 nAsInt32 = 0;
- bConversionSuccess = ::cppu::enum2int(nAsInt32, _rValue);
- bRes = bConversionSuccess && (nAsInt32== *static_cast<const sal_Int32*>(pData));
- break;
- }
- case TypeClass_LONG:
- {
- sal_Int32 aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_UNSIGNED_SHORT:
- {
- sal_uInt16 aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_UNSIGNED_LONG:
- {
- sal_uInt32 aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_INTERFACE:
- {
- css::uno::Reference<css::uno::XInterface> aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- case TypeClass_STRUCT:
- if (_rType == cppu::UnoType<FontDescriptor>::get())
- {
- FontDescriptor aTemp;
- bConversionSuccess = _rValue >>= aTemp;
- if (bConversionSuccess)
- {
- bRes = *static_cast<FontDescriptor const *>(pData) == aTemp;
- }
- else
- bRes = false;
- break;
- }
- if (_rType == cppu::UnoType<Date>::get())
- {
- Date aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- if (_rType == cppu::UnoType<Time>::get())
- {
- Time aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- if (_rType == cppu::UnoType<DateTime>::get())
- {
- DateTime aDummy;
- bConversionSuccess = tryCompare(pData, _rValue, bRes, aDummy);
- break;
- }
- break;
- case TypeClass_SEQUENCE:
- if (_rType == cppu::UnoType<Sequence<sal_Int8>>::get())
- {
- Sequence<sal_Int8> aTemp;
- bConversionSuccess = _rValue >>= aTemp;
- if (bConversionSuccess)
- {
- const Sequence<sal_Int8>& rLeftSeq = *static_cast<const Sequence<sal_Int8>*>(pData);
- const Sequence<sal_Int8>& rRightSeq = aTemp;
- bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
- memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()) == 0;
- }
- }
- else if (_rType == cppu::UnoType<Sequence<sal_Int16>>::get())
- {
- Sequence<sal_Int16> aTemp;
- bConversionSuccess = _rValue >>= aTemp;
- if (bConversionSuccess)
- {
- const Sequence<sal_Int16>& rLeftSeq = *static_cast<const Sequence<sal_Int16>*>(pData);
- const Sequence<sal_Int16>& rRightSeq = aTemp;
- bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
- memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_Int16)) == 0;
- }
- }
- else if (_rType == cppu::UnoType<cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>::get())
- {
- Sequence<sal_uInt16> aTemp;
- bConversionSuccess = _rValue >>= aTemp;
- if (bConversionSuccess)
- {
- const Sequence<sal_uInt16>& rLeftSeq = *static_cast<const Sequence<sal_uInt16>*>(pData);
- const Sequence<sal_uInt16>& rRightSeq = aTemp;
- bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
- memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_uInt16)) == 0;
- }
- }
- else if (_rType == cppu::UnoType<Sequence<sal_Int32>>::get())
- {
- Sequence<sal_Int32> aTemp;
- bConversionSuccess = _rValue >>= aTemp;
- if (bConversionSuccess)
- {
- const Sequence<sal_Int32>& rLeftSeq = *static_cast<const Sequence<sal_Int32>*>(pData);
- const Sequence<sal_Int32>& rRightSeq = aTemp;
- bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
- memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_Int32)) == 0;
- }
- }
- else if (_rType == cppu::UnoType<Sequence<sal_uInt32>>::get())
- {
- Sequence<sal_uInt32> aTemp;
- bConversionSuccess = _rValue >>= aTemp;
- if (bConversionSuccess)
- {
- const Sequence<sal_uInt32>& rLeftSeq = *static_cast<const Sequence<sal_uInt32>*>(pData);
- const Sequence<sal_uInt32>& rRightSeq = aTemp;
- bRes = rLeftSeq.getLength() == rRightSeq.getLength() &&
- memcmp(rLeftSeq.getConstArray(), rRightSeq.getConstArray(), rLeftSeq.getLength()*sizeof(sal_uInt32)) == 0;
- }
- }
- else if (_rType == cppu::UnoType<Sequence<OUString>>::get())
- {
- Sequence< OUString > aTemp;
- bConversionSuccess = _rValue >>= aTemp;
- if (bConversionSuccess)
- {
- const Sequence< OUString >& rLeftSeq = *static_cast<const Sequence< OUString>*>(pData);
- const Sequence< OUString >& rRightSeq = aTemp;
- sal_Int32 nSeqLen = rLeftSeq.getLength();
- bRes = ( nSeqLen == rRightSeq.getLength() );
- for ( sal_Int32 n = 0; bRes && ( n < nSeqLen ); n++ )
- {
- const OUString& rS1 = rLeftSeq.getConstArray()[n];
- const OUString& rS2 = rRightSeq.getConstArray()[n];
- bRes = ( rS1 == rS2 );
- }
- }
- }
- break;
- default:
- bRes = false;
- }
-
- bRes = bRes && bConversionSuccess;
- }
- return bRes;
-}
-
-
-bool compare(const Any& rLeft, const Any& rRight)
-{
- return compare_impl(rLeft.getValueType(), rLeft.getValue(), rRight);
-}
-
-
bool operator ==(const FontDescriptor& _rLeft, const FontDescriptor& _rRight)
{
return ( _rLeft.Name.equals( _rRight.Name ) ) &&