20#ifndef INCLUDED_COMPHELPER_ANYCOMPARE_HXX
21#define INCLUDED_COMPHELPER_ANYCOMPARE_HXX
25#include <com/sun/star/lang/IllegalArgumentException.hpp>
26#include <com/sun/star/i18n/XCollator.hpp>
43 virtual bool isLess( css::uno::Any
const & _lhs, css::uno::Any
const & _rhs )
const = 0;
57 bool operator()( css::uno::Any
const & _lhs, css::uno::Any
const & _rhs )
const
69 template<
typename SCALAR >
73 virtual bool isLess( css::uno::Any
const & _lhs, css::uno::Any
const & _rhs )
const override
75 SCALAR lhs(0), rhs(0);
76 if ( !( _lhs >>= lhs )
79 throw css::lang::IllegalArgumentException();
90 virtual bool isLess( css::uno::Any
const & _lhs, css::uno::Any
const & _rhs )
const override
93 if ( !( _lhs >>= lhs )
96 throw css::lang::IllegalArgumentException();
112 virtual bool isLess( css::uno::Any
const & _lhs, css::uno::Any
const & _rhs )
const override
115 if ( !( _lhs >>= lhs )
118 throw css::lang::IllegalArgumentException();
119 return m_collator->compareString( lhs, rhs ) < 0;
123 css::uno::Reference< css::i18n::XCollator >
const m_collator;
132 virtual bool isLess( css::uno::Any
const & _lhs, css::uno::Any
const & _rhs )
const override
134 css::uno::Type lhs, rhs;
135 if ( !( _lhs >>= lhs )
138 throw css::lang::IllegalArgumentException();
139 return lhs.getTypeName() < rhs.getTypeName();
154 virtual bool isLess( css::uno::Any
const & _lhs, css::uno::Any
const & _rhs )
const override
156 sal_Int32 lhs(0), rhs(0);
162 throw css::lang::IllegalArgumentException();
176 virtual bool isLess( css::uno::Any
const & _lhs, css::uno::Any
const & _rhs )
const override
178 if ( ( _lhs.getValueTypeClass() != css::uno::TypeClass_INTERFACE )
179 || ( _rhs.getValueTypeClass() != css::uno::TypeClass_INTERFACE )
181 throw css::lang::IllegalArgumentException();
183 css::uno::Reference< css::uno::XInterface > lhs( _lhs, css::uno::UNO_QUERY );
184 css::uno::Reference< css::uno::XInterface > rhs( _rhs, css::uno::UNO_QUERY );
185 return lhs.get() < rhs.get();
205 css::uno::Type
const & i_type,
206 css::uno::Reference< css::i18n::XCollator >
const & i_collator
virtual bool isLess(css::uno::Any const &_lhs, css::uno::Any const &_rhs) const override
css::uno::Type const m_enumType
EnumPredicateLess(css::uno::Type const &_enumType)
virtual ~IKeyPredicateLess()
virtual bool isLess(css::uno::Any const &_lhs, css::uno::Any const &_rhs) const =0
virtual bool isLess(css::uno::Any const &_lhs, css::uno::Any const &_rhs) const override
virtual bool isLess(css::uno::Any const &_lhs, css::uno::Any const &_rhs) const override
StringCollationPredicateLess(css::uno::Reference< css::i18n::XCollator > i_collator)
css::uno::Reference< css::i18n::XCollator > const m_collator
virtual bool isLess(css::uno::Any const &_lhs, css::uno::Any const &_rhs) const override
virtual bool isLess(css::uno::Any const &_lhs, css::uno::Any const &_rhs) const override
virtual bool isLess(css::uno::Any const &_lhs, css::uno::Any const &_rhs) const override
#define COMPHELPER_DLLPUBLIC
std::unique_ptr< IKeyPredicateLess > getStandardLessPredicate(Type const &i_type, Reference< XCollator > const &i_collator)
bool anyLess(css::uno::Any const &lhs, css::uno::Any const &rhs)
Compare two Anys.
bool enum2int(sal_Int32 &rnEnum, const css::uno::Any &rAny)
Sets int32 from enum or int in any.
LessPredicateAdapter(const IKeyPredicateLess &_predicate)
bool operator()(css::uno::Any const &_lhs, css::uno::Any const &_rhs) const
IKeyPredicateLess const & m_predicate