#include <klflib.h>


Public Member Functions | |
| KLFLibResourceSimpleEngine (const QUrl &url, uint supportedfeatureflags, QObject *parent=NULL) | |
| virtual | ~KLFLibResourceSimpleEngine () |
| virtual QList< KLFLib::entryId > | allIds (const QString &subResource) |
| virtual bool | hasEntry (const QString &, entryId id) |
| virtual QList< KLFLibEntryWithId > | entries (const QString &, const QList< KLFLib::entryId > &idList, const QList< int > &wantedEntryProperties=QList< int >()) |
| virtual int | query (const QString &subResource, const Query &query, QueryResult *result) |
| virtual QList< QVariant > | queryValues (const QString &subResource, int entryPropId) |
Static Public Member Functions | |
| static int | queryImpl (KLFLibResourceEngine *resource, const QString &subResource, const Query &query, QueryResult *result) |
| static QList< QVariant > | queryValuesImpl (KLFLibResourceEngine *resource, const QString &subResource, int entryPropId) |
| static bool | testEntryMatchConditionImpl (const KLFLib::EntryMatchCondition &condition, const KLFLibEntry &libentry) |
Classes | |
| class | QueryResultListSorter |
| Helper class to sort entries into a KLFLibResourceEngine::QueryResult. More... | |
This class provides default implementations of some pure virtual methods of KLFLibResourceEngine, which call other member functions. The goal is to make life simpler to create a resource engine, where access speed is not a major concern.
For example, KLFLibResourceEngine::allIds() is pure virtual. Normally it can be implemented to be faster than allEntries(), depending on the engine backend. However the functionality can as well easily be achieved by calling KLFLibResourceEngine::allEntries() and returning just a list with all the IDs, at the price of losing optimization.
This class provides non-optimized default implementations for allIds() (as given above), hasEntry(), entries(), and query(), based on the data returned by allEntries() and entry()
Bear in mind that optimizing one or more of those functions is still possible, by reimplementing them (!)
Definition at line 1588 of file klflib.h.
| virtual KLFLibResourceSimpleEngine::~KLFLibResourceSimpleEngine | ( | ) | [inline, virtual] |
| QList< KLFLib::entryId > KLFLibResourceSimpleEngine::allIds | ( | const QString & | subResource | ) | [virtual] |
Implements KLFLibResourceEngine.
Definition at line 897 of file klflib.cpp.
References KLFLibResourceEngine::allEntries(), and QList::size().
Definition at line 907 of file klflib.cpp.
References KLFLibResourceEngine::entry(), KLFLibEntry::latex(), and QString::size().
| QList< KLFLibResourceEngine::KLFLibEntryWithId > KLFLibResourceSimpleEngine::entries | ( | const QString & | subResource, | |
| const QList< KLFLib::entryId > & | idList, | |||
| const QList< int > & | wantedEntryProperties = QList<int>() | |||
| ) | [virtual] |
Implements KLFLibResourceEngine.
Definition at line 914 of file klflib.cpp.
References KLFLibResourceEngine::entry(), and QList::size().
| int KLFLibResourceSimpleEngine::query | ( | const QString & | subResource, | |
| const Query & | query, | |||
| QueryResult * | result | |||
| ) | [virtual] |
| QList< QVariant > KLFLibResourceSimpleEngine::queryValues | ( | const QString & | subResource, | |
| int | entryPropId | |||
| ) | [virtual] |
Implements KLFLibResourceEngine.
Definition at line 932 of file klflib.cpp.
References queryValuesImpl().
| int KLFLibResourceSimpleEngine::queryImpl | ( | KLFLibResourceEngine * | resource, | |
| const QString & | subResource, | |||
| const Query & | query, | |||
| QueryResult * | result | |||
| ) | [static] |
A basic implementation of query() based on matching the results of resource->allEntries().
Definition at line 964 of file klflib.cpp.
References KLFLibResourceEngine::allEntries(), KLFLibResourceEngine::KLFLibEntryWithId::entry, KLFLibResourceEngine::QueryResult::entryIdList, KLFLibResourceEngine::QueryResult::entryWithIdList, KLFLibResourceSimpleEngine::QueryResultListSorter::insertIntoOrderedResult(), KLF_DEBUG_TEE, KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, klfDbgSt, KLFLibResourceEngine::Query::limit, KLFLibResourceEngine::Query::matchCondition, KLFLibResourceSimpleEngine::QueryResultListSorter::numberOfEntries(), KLFLibResourceEngine::Query::orderDirection, KLFLibResourceEngine::Query::orderPropId, qlist_skip_and_limit(), KLFLibResourceEngine::QueryResult::rawEntryList, QList::size(), KLFLibResourceEngine::Query::skip, and testEntryMatchConditionImpl().
Referenced by KLFLibDBEngine::query(), and query().
| QList< QVariant > KLFLibResourceSimpleEngine::queryValuesImpl | ( | KLFLibResourceEngine * | resource, | |
| const QString & | subResource, | |||
| int | entryPropId | |||
| ) | [static] |
A basic implementation of queryValues() based on looking at the results of resource->allEntries()
Definition at line 1008 of file klflib.cpp.
References KLFLibResourceEngine::allEntries(), QList::contains(), and QList::size().
Referenced by queryValues().
| bool KLFLibResourceSimpleEngine::testEntryMatchConditionImpl | ( | const KLFLib::EntryMatchCondition & | condition, | |
| const KLFLibEntry & | libentry | |||
| ) | [static] |
A simple entry condition tester.
Definition at line 1024 of file klflib.cpp.
References KLFLib::EntryMatchCondition::AndMatchType, KLFLib::EntryMatchCondition::conditionList(), QList::isEmpty(), KLF_FUNC_NAME, klfMatch(), KLFLib::EntryMatchCondition::MatchAllType, KLFLib::StringMatch::matchFlags(), KLFLib::StringMatch::matchValue(), KLFLib::StringMatch::matchValueString(), KLFLib::EntryMatchCondition::NegateMatchType, KLFLib::EntryMatchCondition::OrMatchType, KLFPropertizedObject::property(), KLFLib::PropertyMatch::propertyId(), KLFLib::EntryMatchCondition::propertyMatch(), KLFLib::EntryMatchCondition::PropertyMatchType, QList::size(), and KLFLib::EntryMatchCondition::type().
Referenced by queryImpl().