diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-02-03 09:41:02 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-02-03 09:41:02 +0100 |
commit | 2e21a7ec4b9aea1c64025896558e5d73e34271cc (patch) | |
tree | 138b2a5e31d749832f3c7f4402e5006b12ce0555 /comphelper | |
parent | 99ff7a9fb521895d6ba18ca4ca92d7eb0c3524fd (diff) | |
parent | 0fd19afca7b8063a964032704a9ac6f4ee6e7911 (diff) |
pulled and merged DEV300.m99
Diffstat (limited to 'comphelper')
-rwxr-xr-x | comphelper/inc/comphelper/anycompare.hxx | 226 | ||||
-rwxr-xr-x | comphelper/inc/comphelper/componentguard.hxx | 70 | ||||
-rw-r--r-- | comphelper/source/container/enumerablemap.cxx | 205 | ||||
-rwxr-xr-x | comphelper/source/misc/anycompare.cxx | 131 | ||||
-rw-r--r-- | comphelper/source/misc/makefile.mk | 1 |
5 files changed, 434 insertions, 199 deletions
diff --git a/comphelper/inc/comphelper/anycompare.hxx b/comphelper/inc/comphelper/anycompare.hxx new file mode 100755 index 000000000000..03f41e108ba9 --- /dev/null +++ b/comphelper/inc/comphelper/anycompare.hxx @@ -0,0 +1,226 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef COMPHELPER_ANYCOMPARE_HXX +#define COMPHELPER_ANYCOMPARE_HXX + +#include "comphelper/comphelperdllapi.h" + +/** === begin UNO includes === **/ +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/i18n/XCollator.hpp> +/** === end UNO includes === **/ + +#include <comphelper/extract.hxx> + +#include <functional> +#include <memory> + +//...................................................................................................................... +namespace comphelper +{ +//...................................................................................................................... + + //================================================================================================================== + //= IKeyPredicateLess + //================================================================================================================== + class SAL_NO_VTABLE IKeyPredicateLess + { + public: + virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const = 0; + virtual ~IKeyPredicateLess() {} + }; + + //================================================================================================================== + //= LessPredicateAdapter + //================================================================================================================== + struct LessPredicateAdapter : public ::std::binary_function< ::com::sun::star::uno::Any, ::com::sun::star::uno::Any, bool > + { + LessPredicateAdapter( const IKeyPredicateLess& _predicate ) + :m_predicate( _predicate ) + { + } + + bool operator()( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const + { + return m_predicate.isLess( _lhs, _rhs ); + } + + private: + IKeyPredicateLess const & m_predicate; + + private: + LessPredicateAdapter(); // never implemented + }; + + //================================================================================================================== + //= ScalarPredicateLess + //================================================================================================================== + template< typename SCALAR > + class ScalarPredicateLess : public IKeyPredicateLess + { + public: + virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const + { + SCALAR lhs(0), rhs(0); + if ( !( _lhs >>= lhs ) + || !( _rhs >>= rhs ) + ) + throw ::com::sun::star::lang::IllegalArgumentException(); + return lhs < rhs; + } + }; + + //================================================================================================================== + //= StringPredicateLess + //================================================================================================================== + class StringPredicateLess : public IKeyPredicateLess + { + public: + virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const + { + ::rtl::OUString lhs, rhs; + if ( !( _lhs >>= lhs ) + || !( _rhs >>= rhs ) + ) + throw ::com::sun::star::lang::IllegalArgumentException(); + return lhs < rhs; + } + }; + + //================================================================================================================== + //= StringCollationPredicateLess + //================================================================================================================== + class StringCollationPredicateLess : public IKeyPredicateLess + { + public: + StringCollationPredicateLess( ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const & i_collator ) + :m_collator( i_collator ) + { + } + + virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const + { + ::rtl::OUString lhs, rhs; + if ( !( _lhs >>= lhs ) + || !( _rhs >>= rhs ) + ) + throw ::com::sun::star::lang::IllegalArgumentException(); + return m_collator->compareString( lhs, rhs ) < 0; + } + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const m_collator; + }; + + //================================================================================================================== + //= TypePredicateLess + //================================================================================================================== + class TypePredicateLess : public IKeyPredicateLess + { + public: + virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const + { + ::com::sun::star::uno::Type lhs, rhs; + if ( !( _lhs >>= lhs ) + || !( _rhs >>= rhs ) + ) + throw ::com::sun::star::lang::IllegalArgumentException(); + return lhs.getTypeName() < rhs.getTypeName(); + } + }; + + //================================================================================================================== + //= EnumPredicateLess + //================================================================================================================== + class EnumPredicateLess : public IKeyPredicateLess + { + public: + EnumPredicateLess( ::com::sun::star::uno::Type const & _enumType ) + :m_enumType( _enumType ) + { + } + + virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const + { + sal_Int32 lhs(0), rhs(0); + if ( !::cppu::enum2int( lhs, _lhs ) + || !::cppu::enum2int( rhs, _rhs ) + || !_lhs.getValueType().equals( m_enumType ) + || !_rhs.getValueType().equals( m_enumType ) + ) + throw ::com::sun::star::lang::IllegalArgumentException(); + return lhs < rhs; + } + + private: + ::com::sun::star::uno::Type const m_enumType; + }; + + //================================================================================================================== + //= InterfacePredicateLess + //================================================================================================================== + class InterfacePredicateLess : public IKeyPredicateLess + { + public: + virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const + { + if ( ( _lhs.getValueTypeClass() != ::com::sun::star::uno::TypeClass_INTERFACE ) + || ( _rhs.getValueTypeClass() != ::com::sun::star::uno::TypeClass_INTERFACE ) + ) + throw ::com::sun::star::lang::IllegalArgumentException(); + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > lhs( _lhs, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rhs( _rhs, ::com::sun::star::uno::UNO_QUERY ); + return lhs.get() < rhs.get(); + } + }; + + //================================================================================================================== + //= getStandardLessPredicate + //================================================================================================================== + /** creates a default IKeyPredicateLess instance for the given UNO type + @param i_type + the type for which a predicate instance should be created + @param i_collator + specifies a collator instance to use, or <NULL/>. If <NULL/>, strings will be compared using the <code><</code> + operator, otherwise the collator will be used. The parameter is ignored if <arg>i_type</arg> does not specify + the string type. + @return + a default implementation of IKeyPredicateLess, which is able to compare values of the given type. If no + such default implementation is known for the given type, then <NULL/> is returned. + */ + ::std::auto_ptr< IKeyPredicateLess > COMPHELPER_DLLPUBLIC + getStandardLessPredicate( + ::com::sun::star::uno::Type const & i_type, + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const & i_collator + ); + +//...................................................................................................................... +} // namespace comphelper +//...................................................................................................................... + +#endif // COMPHELPER_ANYCOMPARE_HXX diff --git a/comphelper/inc/comphelper/componentguard.hxx b/comphelper/inc/comphelper/componentguard.hxx new file mode 100755 index 000000000000..820b901a5c55 --- /dev/null +++ b/comphelper/inc/comphelper/componentguard.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef COMPHELPER_COMPONENTGUARD_HXX +#define COMPHELPER_COMPONENTGUARD_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/lang/DisposedException.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +//...................................................................................................................... +namespace comphelper +{ +//...................................................................................................................... + + //================================================================================================================== + //= ComponentGuard + //================================================================================================================== + class ComponentGuard + { + public: + ComponentGuard( ::cppu::OWeakObject& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper ) + :m_aGuard( i_broadcastHelper.rMutex ) + { + if ( i_broadcastHelper.bDisposed ) + throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), &i_component ); + } + + ~ComponentGuard() + { + } + + void clear() { m_aGuard.clear(); } + void reset() { m_aGuard.reset(); } + + private: + ::osl::ResettableMutexGuard m_aGuard; + }; + +//...................................................................................................................... +} // namespace comphelper +//...................................................................................................................... + +#endif // COMPHELPER_COMPONENTGUARD_HXX diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx index 15241cd72dd6..a73983517751 100644 --- a/comphelper/source/container/enumerablemap.cxx +++ b/comphelper/source/container/enumerablemap.cxx @@ -24,11 +24,11 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_comphelper.hxx" #include "comphelper_module.hxx" #include "comphelper/anytostring.hxx" +#include "comphelper/anycompare.hxx" #include "comphelper/componentbase.hxx" #include "comphelper/componentcontext.hxx" #include "comphelper/extract.hxx" @@ -47,9 +47,7 @@ #include <rtl/ustrbuf.hxx> #include <typelib/typedescription.hxx> -#include <functional> #include <map> -#include <memory> #include <boost/shared_ptr.hpp> //........................................................................ @@ -79,26 +77,14 @@ namespace comphelper using ::com::sun::star::beans::Pair; using ::com::sun::star::uno::TypeClass; using ::com::sun::star::uno::TypeClass_VOID; - using ::com::sun::star::uno::TypeClass_CHAR; - using ::com::sun::star::uno::TypeClass_BOOLEAN; - using ::com::sun::star::uno::TypeClass_BYTE; - using ::com::sun::star::uno::TypeClass_SHORT; - using ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT; - using ::com::sun::star::uno::TypeClass_LONG; - using ::com::sun::star::uno::TypeClass_UNSIGNED_LONG; - using ::com::sun::star::uno::TypeClass_HYPER; - using ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER; - using ::com::sun::star::uno::TypeClass_FLOAT; - using ::com::sun::star::uno::TypeClass_DOUBLE; - using ::com::sun::star::uno::TypeClass_STRING; - using ::com::sun::star::uno::TypeClass_TYPE; - using ::com::sun::star::uno::TypeClass_ENUM; - using ::com::sun::star::uno::TypeClass_INTERFACE; using ::com::sun::star::uno::TypeClass_UNKNOWN; using ::com::sun::star::uno::TypeClass_ANY; using ::com::sun::star::uno::TypeClass_EXCEPTION; using ::com::sun::star::uno::TypeClass_STRUCT; using ::com::sun::star::uno::TypeClass_UNION; + using ::com::sun::star::uno::TypeClass_FLOAT; + using ::com::sun::star::uno::TypeClass_DOUBLE; + using ::com::sun::star::uno::TypeClass_INTERFACE; using ::com::sun::star::lang::XServiceInfo; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::container::XEnumeration; @@ -108,136 +94,6 @@ namespace comphelper /** === end UNO using === **/ //==================================================================== - //= IKeyPredicateLess - //==================================================================== - class SAL_NO_VTABLE IKeyPredicateLess - { - public: - virtual bool isLess( const Any& _lhs, const Any& _rhs ) const = 0; - virtual ~IKeyPredicateLess() {} - }; - - //==================================================================== - //= LessPredicateAdapter - //==================================================================== - struct LessPredicateAdapter : public ::std::binary_function< Any, Any, bool > - { - LessPredicateAdapter( const IKeyPredicateLess& _predicate ) - :m_predicate( _predicate ) - { - } - - bool operator()( const Any& _lhs, const Any& _rhs ) const - { - return m_predicate.isLess( _lhs, _rhs ); - } - - private: - const IKeyPredicateLess& m_predicate; - - private: - LessPredicateAdapter(); // never implemented - }; - - //==================================================================== - //= ScalarPredicateLess - //==================================================================== - template< typename SCALAR > - class ScalarPredicateLess : public IKeyPredicateLess - { - public: - virtual bool isLess( const Any& _lhs, const Any& _rhs ) const - { - SCALAR lhs(0), rhs(0); - if ( !( _lhs >>= lhs ) - || !( _rhs >>= rhs ) - ) - throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 ); - return lhs < rhs; - } - }; - - //==================================================================== - //= StringPredicateLess - //==================================================================== - class StringPredicateLess : public IKeyPredicateLess - { - public: - virtual bool isLess( const Any& _lhs, const Any& _rhs ) const - { - ::rtl::OUString lhs, rhs; - if ( !( _lhs >>= lhs ) - || !( _rhs >>= rhs ) - ) - throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 ); - return lhs < rhs; - } - }; - - //==================================================================== - //= TypePredicateLess - //==================================================================== - class TypePredicateLess : public IKeyPredicateLess - { - public: - virtual bool isLess( const Any& _lhs, const Any& _rhs ) const - { - Type lhs, rhs; - if ( !( _lhs >>= lhs ) - || !( _rhs >>= rhs ) - ) - throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 ); - return lhs.getTypeName() < rhs.getTypeName(); - } - }; - - //==================================================================== - //= EnumPredicateLess - //==================================================================== - class EnumPredicateLess : public IKeyPredicateLess - { - public: - EnumPredicateLess( const Type& _enumType ) - :m_enumType( _enumType ) - { - } - - virtual bool isLess( const Any& _lhs, const Any& _rhs ) const - { - sal_Int32 lhs(0), rhs(0); - if ( !::cppu::enum2int( lhs, _lhs ) - || !::cppu::enum2int( rhs, _rhs ) - || !_lhs.getValueType().equals( m_enumType ) - || !_rhs.getValueType().equals( m_enumType ) - ) - throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 ); - return lhs < rhs; - } - - private: - const Type m_enumType; - }; - - //==================================================================== - //= InterfacePredicateLess - //==================================================================== - class InterfacePredicateLess : public IKeyPredicateLess - { - public: - virtual bool isLess( const Any& _lhs, const Any& _rhs ) const - { - if ( ( _lhs.getValueTypeClass() != TypeClass_INTERFACE ) - || ( _rhs.getValueTypeClass() != TypeClass_INTERFACE ) - ) - throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 ); - - Reference< XInterface > lhs( _lhs, UNO_QUERY ); - Reference< XInterface > rhs( _rhs, UNO_QUERY ); - return lhs.get() < rhs.get(); - } - }; - - //==================================================================== //= MapData //==================================================================== class IMapModificationListener; @@ -549,58 +405,9 @@ namespace comphelper throw IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported value type." ) ), *this ); // create the comparator for the KeyType, and throw if the type is not supported - TypeClass eKeyTypeClass = aKeyType.getTypeClass(); - ::std::auto_ptr< IKeyPredicateLess > pComparator; - switch ( eKeyTypeClass ) - { - case TypeClass_CHAR: - pComparator.reset( new ScalarPredicateLess< sal_Unicode >() ); - break; - case TypeClass_BOOLEAN: - pComparator.reset( new ScalarPredicateLess< sal_Bool >() ); - break; - case TypeClass_BYTE: - pComparator.reset( new ScalarPredicateLess< sal_Int8 >() ); - break; - case TypeClass_SHORT: - pComparator.reset( new ScalarPredicateLess< sal_Int16 >() ); - break; - case TypeClass_UNSIGNED_SHORT: - pComparator.reset( new ScalarPredicateLess< sal_uInt16 >() ); - break; - case TypeClass_LONG: - pComparator.reset( new ScalarPredicateLess< sal_Int32 >() ); - break; - case TypeClass_UNSIGNED_LONG: - pComparator.reset( new ScalarPredicateLess< sal_uInt32 >() ); - break; - case TypeClass_HYPER: - pComparator.reset( new ScalarPredicateLess< sal_Int64 >() ); - break; - case TypeClass_UNSIGNED_HYPER: - pComparator.reset( new ScalarPredicateLess< sal_uInt64 >() ); - break; - case TypeClass_FLOAT: - pComparator.reset( new ScalarPredicateLess< float >() ); - break; - case TypeClass_DOUBLE: - pComparator.reset( new ScalarPredicateLess< double >() ); - break; - case TypeClass_STRING: - pComparator.reset( new StringPredicateLess() ); - break; - case TypeClass_TYPE: - pComparator.reset( new TypePredicateLess() ); - break; - case TypeClass_ENUM: - pComparator.reset( new EnumPredicateLess( aKeyType ) ); - break; - case TypeClass_INTERFACE: - pComparator.reset( new InterfacePredicateLess() ); - break; - default: + ::std::auto_ptr< IKeyPredicateLess > pComparator( getStandardLessPredicate( aKeyType, NULL ) ); + if ( !pComparator.get() ) throw IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), *this ); - } // init members m_aData.m_aKeyType = aKeyType; diff --git a/comphelper/source/misc/anycompare.cxx b/comphelper/source/misc/anycompare.cxx new file mode 100755 index 000000000000..a86174daf08e --- /dev/null +++ b/comphelper/source/misc/anycompare.cxx @@ -0,0 +1,131 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_comphelper.hxx" + +#include "comphelper/anycompare.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +//...................................................................................................................... +namespace comphelper +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::TypeClass_CHAR; + using ::com::sun::star::uno::TypeClass_BOOLEAN; + using ::com::sun::star::uno::TypeClass_BYTE; + using ::com::sun::star::uno::TypeClass_SHORT; + using ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT; + using ::com::sun::star::uno::TypeClass_LONG; + using ::com::sun::star::uno::TypeClass_UNSIGNED_LONG; + using ::com::sun::star::uno::TypeClass_HYPER; + using ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER; + using ::com::sun::star::uno::TypeClass_FLOAT; + using ::com::sun::star::uno::TypeClass_DOUBLE; + using ::com::sun::star::uno::TypeClass_STRING; + using ::com::sun::star::uno::TypeClass_TYPE; + using ::com::sun::star::uno::TypeClass_ENUM; + using ::com::sun::star::uno::TypeClass_INTERFACE; + using ::com::sun::star::i18n::XCollator; + /** === end UNO using === **/ + + //------------------------------------------------------------------------------------------------------------------ + ::std::auto_ptr< IKeyPredicateLess > getStandardLessPredicate( Type const & i_type, Reference< XCollator > const & i_collator ) + { + ::std::auto_ptr< IKeyPredicateLess > pComparator; + switch ( i_type.getTypeClass() ) + { + case TypeClass_CHAR: + pComparator.reset( new ScalarPredicateLess< sal_Unicode >() ); + break; + case TypeClass_BOOLEAN: + pComparator.reset( new ScalarPredicateLess< sal_Bool >() ); + break; + case TypeClass_BYTE: + pComparator.reset( new ScalarPredicateLess< sal_Int8 >() ); + break; + case TypeClass_SHORT: + pComparator.reset( new ScalarPredicateLess< sal_Int16 >() ); + break; + case TypeClass_UNSIGNED_SHORT: + pComparator.reset( new ScalarPredicateLess< sal_uInt16 >() ); + break; + case TypeClass_LONG: + pComparator.reset( new ScalarPredicateLess< sal_Int32 >() ); + break; + case TypeClass_UNSIGNED_LONG: + pComparator.reset( new ScalarPredicateLess< sal_uInt32 >() ); + break; + case TypeClass_HYPER: + pComparator.reset( new ScalarPredicateLess< sal_Int64 >() ); + break; + case TypeClass_UNSIGNED_HYPER: + pComparator.reset( new ScalarPredicateLess< sal_uInt64 >() ); + break; + case TypeClass_FLOAT: + pComparator.reset( new ScalarPredicateLess< float >() ); + break; + case TypeClass_DOUBLE: + pComparator.reset( new ScalarPredicateLess< double >() ); + break; + case TypeClass_STRING: + if ( i_collator.is() ) + pComparator.reset( new StringCollationPredicateLess( i_collator ) ); + else + pComparator.reset( new StringPredicateLess() ); + break; + case TypeClass_TYPE: + pComparator.reset( new TypePredicateLess() ); + break; + case TypeClass_ENUM: + pComparator.reset( new EnumPredicateLess( i_type ) ); + break; + case TypeClass_INTERFACE: + pComparator.reset( new InterfacePredicateLess() ); + break; + default: + break; + } + return pComparator; + } + +//...................................................................................................................... +} // namespace comphelper +//...................................................................................................................... diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk index 0bb4defb4165..2f421bdde70d 100644 --- a/comphelper/source/misc/makefile.mk +++ b/comphelper/source/misc/makefile.mk @@ -93,6 +93,7 @@ SLOFILES= \ $(SLO)$/comphelper_services.obj \ $(SLO)$/componentbase.obj \ $(SLO)$/stillreadwriteinteraction.obj \ + $(SLO)$/anycompare.obj \ # --- Targets ---------------------------------- |