Helper class to sort entries into a KLFLibResourceEngine::QueryResult. More...
#include <klflib.h>
Public Member Functions | |
QueryResultListSorter (KLFLibEntrySorter *sorter, QueryResult *result) | |
bool | operator() (const KLFLibEntry &a, const KLFLibEntry &b) |
Compares KLFLibEntry'ies. More... | |
bool | operator() (const KLFLibEntryWithId &a, const KLFLibEntryWithId &b) |
Compares KLFLibResourceEngine::KLFLibEntryWithId's. More... | |
int | numberOfEntries () |
void | insertIntoOrderedResult (const KLFLibEntryWithId &entry) |
Helper class to sort entries into a KLFLibResourceEngine::QueryResult.
KLFLibResourceSimpleEngine::QueryResultListSorter::QueryResultListSorter | ( | KLFLibEntrySorter * | sorter, |
QueryResult * | result | ||
) |
Build an QueryResultListSorter object, that should sort entries according to sorter
. See also KLFLibEntrySorter.
sorter
must not be NULL.
Definition at line 1072 of file klflib.cpp.
References KLFLibResourceEngine::QueryResult::FillEntryWithIdList, KLFLibResourceEngine::QueryResult::fillFlags, KLFLibResourceEngine::QueryResult::FillRawEntryList, and KLF_ASSERT_NOT_NULL.
void KLFLibResourceSimpleEngine::QueryResultListSorter::insertIntoOrderedResult | ( | const KLFLibEntryWithId & | entry | ) |
Inserts the entry-with-id entrywid
, into the appropriate lists in the result
that was given to the constructor, such that the lists are ordered according to the sorter set in the constructor.
By appropriate we mean the lists for which the fill flags are set in the QueryResult object.
If the set sorter's sorting property ID is -1
, then the elements are simply appended to the appropriate lists; sorting is disabled in this case.
When sorting is enabled, this function assumes that the lists in result
are sorted appropriately. This is naturally the case if you only use this function to build the lists. In other terms, don't call this function if you already added non-sorted items into the list(s).
Definition at line 1112 of file klflib.cpp.
References QList::begin(), KLFLibResourceEngine::KLFLibEntryWithId::entry, KLFLibResourceEngine::QueryResult::FillEntryIdList, KLFLibResourceEngine::QueryResult::FillEntryWithIdList, KLFLibResourceEngine::QueryResult::FillRawEntryList, KLFLibResourceEngine::KLFLibEntryWithId::id, klf_lower_bound_entry, and klf_lower_bound_ewid.
Referenced by KLFLibResourceSimpleEngine::queryImpl().
int KLFLibResourceSimpleEngine::QueryResultListSorter::numberOfEntries | ( | ) |
Returns the number of entries there are in the lists (ignoring those lists left empty, of course).
Definition at line 1090 of file klflib.cpp.
Referenced by KLFLibResourceSimpleEngine::queryImpl().
|
inline |
Compares KLFLibEntry'ies.
|
inline |
Compares KLFLibResourceEngine::KLFLibEntryWithId's.
Definition at line 1628 of file klflib.h.
References KLFLibResourceEngine::KLFLibEntryWithId::entry.