34 explicit TKeyValueFunc(
OSortIndex* _pIndex) : pIndex(_pIndex)
38 bool operator()(
const OSortIndex::TIntValuePairVector::value_type& lhs,
const OSortIndex::TIntValuePairVector::value_type& rhs)
const
40 const std::vector<OKeyType>& aKeyType = pIndex->
getKeyType();
42 for (
auto const& elem : aKeyType)
44 const bool bGreater = pIndex->
getAscending(i) != TAscendingOrder::ASC;
45 const bool bLess = !bGreater;
50 case OKeyType::String:
52 sal_Int32 nRes = lhs.second->getKeyString(i).compareTo(rhs.second->getKeyString(i));
59 case OKeyType::Double:
61 double d1 = lhs.second->getKeyDouble(i);
62 double d2 = rhs.second->getKeyDouble(i);
91 ,std::back_inserter(*pKeySet)
98 std::vector<TAscendingOrder>&& _aAscending)
100 ,m_aAscending(
std::move(_aAscending))
111 assert(pKeyValue &&
"Can not be null here!");
114 m_aKeyValues.push_back({pKeyValue->getValue(),
nullptr});
117 m_aKeyValues.push_back({pKeyValue->getValue(),std::move(pKeyValue)});
122 OSL_ENSURE(!
m_bFrozen,
"OSortIndex::Freeze: already frozen!");
130 keyValue.second.reset();
148 return std::unique_ptr<OKeyValue>(
new OKeyValue(_nVal));
The class OKeySet is a refcountable vector which also has a state.
OKeyValue(sal_Int32 nVal)
static std::unique_ptr< OKeyValue > createKeyValue(sal_Int32 nVal)
The class OSortIndex can be used to implement a sorted index.
TKeyTypeVector m_aKeyType
void Freeze()
Freeze freezes the sortindex so that new values could only be appended by their value.
OSortIndex(std::vector< OKeyType > &&_aKeyType, std::vector< TAscendingOrder > &&_aAscending)
TIntValuePairVector m_aKeyValues
const std::vector< OKeyType > & getKeyType() const
TAscendingOrder getAscending(std::vector< TAscendingOrder >::size_type _nPos) const
void AddKeyValue(std::unique_ptr< OKeyValue > pKeyValue)
AddKeyValue appends a new value.