[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project
Public Member Functions | List of all members
KLFLibResourceSimpleEngine::QueryResultListSorter Class Reference

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)
 

Detailed Description

Helper class to sort entries into a KLFLibResourceEngine::QueryResult.

Definition at line 1607 of file klflib.h.

Constructor & Destructor Documentation

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.

Member Function Documentation

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).

Note
if the fill flags include neither the raw entry list, nor the entry-with-id list, then the raw entry list is also filled, as it is not possible to just compare bare entry IDs (!)

Definition at line 1112 of file klflib.cpp.

References QList::begin(), QList::end(), KLFLibResourceEngine::KLFLibEntryWithId::entry, KLFLibResourceEngine::QueryResult::entryIdList, KLFLibResourceEngine::QueryResult::entryWithIdList, KLFLibResourceEngine::QueryResult::FillEntryIdList, KLFLibResourceEngine::QueryResult::FillEntryWithIdList, KLFLibResourceEngine::QueryResult::FillRawEntryList, KLFLibResourceEngine::KLFLibEntryWithId::id, QList::insert(), klf_lower_bound_entry, klf_lower_bound_ewid, KLFLibEntrySorter::propId(), KLFLibResourceEngine::QueryResult::rawEntryList, and QList::size().

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.

References KLFLibResourceEngine::QueryResult::entryWithIdList, KLFLibResourceEngine::QueryResult::rawEntryList, and QList::size().

Referenced by KLFLibResourceSimpleEngine::queryImpl().

bool KLFLibResourceSimpleEngine::QueryResultListSorter::operator() ( const KLFLibEntry a,
const KLFLibEntry b 
)
inline

Compares KLFLibEntry'ies.

Definition at line 1624 of file klflib.h.

bool KLFLibResourceSimpleEngine::QueryResultListSorter::operator() ( const KLFLibEntryWithId a,
const KLFLibEntryWithId b 
)
inline

The documentation for this class was generated from the following files:

Generated by doxygen 1.8.11