Provides a simple API for reading library resources. More...
#include <klflib.h>
Classes | |
class | QueryResultListSorter |
Helper class to sort entries into a KLFLibResourceEngine::QueryResult. More... | |
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) |
![]() | |
KLFLibResourceEngine (const QUrl &url, uint supportedfeatureflags, QObject *parent=NULL) | |
virtual | ~KLFLibResourceEngine () |
virtual uint | supportedFeatureFlags () const |
List of features supported by this resource engine. More... | |
virtual QUrl | url (uint flags=0x0) const |
query URL More... | |
virtual uint | compareUrlTo (const QUrl &other, uint interestFlags=0xfffffff) const =0 |
Compare this resource's URL with another's. More... | |
virtual bool | isReadOnly () const |
query read-only state More... | |
virtual QString | title () const |
The human-set title of this resource. More... | |
virtual bool | locked () const |
Is this resource is locked? More... | |
virtual QString | viewType () const |
The (last) View Type used to display this resource. More... | |
virtual bool | accessShared () const |
If the resource is accessed by many clients. More... | |
virtual QVariant | resourceProperty (const QString &name) const |
Get the value of a resource property. More... | |
virtual bool | canModifyData (const QString &subResource, ModifyType modifytype) const |
virtual bool | canModifyData (ModifyType modifytype) const |
virtual bool | canModifyProp (int propId) const |
virtual bool | canRegisterProperty (const QString &propName) const |
virtual QString | suggestedViewTypeIdentifier () const |
virtual bool | hasSubResource (const QString &subResource) const |
virtual QStringList | subResourceList () const |
virtual QString | defaultSubResource () const |
virtual bool | compareDefaultSubResourceEquals (const QString &subResourceName) const |
Compare our sub-resource name to another. More... | |
virtual bool | canCreateSubResource () const |
virtual bool | canRenameSubResource (const QString &subResource) const |
virtual bool | canDeleteSubResource (const QString &subResource) const |
virtual QVariant | subResourceProperty (const QString &subResource, int propId) const |
virtual QList< int > | subResourcePropertyIdList () const |
virtual QString | subResourcePropertyName (int propId) const |
virtual bool | canModifySubResourceProperty (const QString &subResource, int propId) const |
virtual KLFLibEntry | entry (const QString &subResource, entryId id)=0 |
query an entry in this resource More... | |
virtual KLFLibEntry | entry (entryId id) |
query an entry in this resource More... | |
virtual bool | hasEntry (entryId id) |
query the existence of an entry in this resource More... | |
virtual QList< KLFLibEntryWithId > | entries (const QList< KLFLib::entryId > &idList, const QList< int > &wantedEntryProperties=QList< int >()) |
query multiple entries in this resource More... | |
virtual QList< KLFLib::entryId > | allIds () |
Returns all IDs in this resource (and the default sub-resource) More... | |
virtual QList< KLFLibEntryWithId > | allEntries (const QString &subResource, const QList< int > &wantedEntryProperties=QList< int >())=0 |
query all entries in this resource More... | |
virtual QList< KLFLibEntryWithId > | allEntries (const QList< int > &wantedEntryProperties=QList< int >()) |
query all entries in this resource More... | |
void | blockProgressReportingForNextOperation () |
Specifies that the next operation (only) should not report progress. More... | |
void | blockProgressReporting (bool block) |
(Un)Blocks generally progress reporting More... | |
![]() | |
QObject (QObject *parent=0) | |
blockSignals (bool block) | |
childEvent (QChildEvent *event) | |
children () | |
connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type=Qt::AutoCompatConnection) | |
connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type=Qt::AutoCompatConnection) | |
connectNotify (const char *signal) | |
customEvent (QEvent *event) | |
deleteLater () | |
destroyed (QObject *obj=0) | |
disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) | |
disconnect (const char *signal=0, const QObject *receiver=0, const char *method=0) | |
disconnect (const QObject *receiver, const char *method=0) | |
disconnectNotify (const char *signal) | |
dumpObjectInfo () | |
dumpObjectTree () | |
dynamicPropertyNames () | |
event (QEvent *e) | |
eventFilter (QObject *watched, QEvent *event) | |
findChild (const QString &name=QString() | |
findChildren (const QString &name=QString() | |
findChildren (const QRegExp ®Exp) | |
inherits (const char *className) | |
installEventFilter (QObject *filterObj) | |
isWidgetType () | |
killTimer (int id) | |
metaObject () | |
moveToThread (QThread *targetThread) | |
parent () | |
property (const char *name) | |
receivers (const char *signal) | |
removeEventFilter (QObject *obj) | |
sender () | |
setParent (QObject *parent) | |
setProperty (const char *name, const QVariant &value) | |
signalsBlocked () | |
startTimer (int interval) | |
thread () | |
timerEvent (QTimerEvent *event) | |
tr (const char *sourceText, const char *comment=0, int n=-1) | |
trUtf8 (const char *sourceText, const char *comment=0, int n=-1) | |
staticMetaObject | |
QObject (QObject *parent, const char *name) | |
checkConnectArgs (const char *signal, const QObject *object, const char *method) | |
child (const char *objName, const char *inheritsClass=0, bool recursiveSearch=true) | |
className () | |
insertChild (QObject *object) | |
isA (const char *className) | |
name () | |
name (const char *defaultName) | |
normalizeSignalSlot (const char *signalSlot) | |
removeChild (QObject *object) | |
setName (const char *name) | |
![]() | |
KLFPropertizedObject (const QString &propertyNameSpace) | |
virtual | ~KLFPropertizedObject () |
virtual QVariant | property (const QString &propName) const |
virtual QVariant | property (int propId) const |
QList< int > | propertyIdList () const |
QStringList | propertyNameList () const |
QMap< QString, QVariant > | allProperties () const |
void | setAllProperties (const QMap< QString, QVariant > &propValues) |
QByteArray | allPropertiesToByteArray () const |
void | setAllPropertiesFromByteArray (const QByteArray &data) |
virtual QString | toString (uint toStringFlags=0) const |
int | propertyMaxId () const |
bool | propertyIdRegistered (int propId) const |
bool | propertyNameRegistered (const QString &propertyName) const |
int | propertyIdForName (const QString &propertyName) const |
QString | propertyNameForId (int propId) const |
QList< int > | registeredPropertyIdList () const |
QStringList | registeredPropertyNameList () const |
QMap< QString, int > | registeredProperties () const |
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) |
Additional Inherited Members | |
![]() | |
enum | ResourceProperty { PropTitle = 0, PropLocked, PropViewType, PropAccessShared } |
enum | SubResourceProperty { SubResPropTitle = 0, SubResPropLocked = 1, SubResPropViewType = 2 } |
enum | ResourceFeature { FeatureReadOnly = 0x0001, FeatureLocked = 0x0002, FeatureSaveTo = 0x0004, FeatureSubResources = 0x0008, FeatureSubResourceProps = 0x0010 } |
Features that may or may not be implemented by subclasses. More... | |
enum | WantUrlFormatFlag { WantUrlDefaultSubResource = 0x01, WantUrlReadOnly = 0x02 } |
Format options one can give to url() More... | |
enum | ModifyType { AllActionsData = 0, UnknownModification = 0, InsertData, ChangeData, DeleteData } |
typedef KLFLib::entryId | entryId |
![]() | |
enum | ToStringFlag |
![]() | |
virtual bool | setTitle (const QString &title) |
set a new resource title for this library resource More... | |
virtual bool | setLocked (bool locked) |
Set the resource to be locked. More... | |
virtual bool | setViewType (const QString &viewType) |
virtual bool | setReadOnly (bool readonly) |
Set the resource to be read-only or not. More... | |
virtual void | setDefaultSubResource (const QString &subResource) |
Set the default sub-resource. More... | |
virtual bool | createSubResource (const QString &subResource, const QString &subResourceTitle) |
Create a new sub-resource. More... | |
virtual bool | createSubResource (const QString &subResource) |
Create a new sub-resource. More... | |
virtual bool | renameSubResource (const QString &oldSubResourceName, const QString &newSubResourceName) |
virtual bool | deleteSubResource (const QString &subResource) |
virtual bool | setSubResourceProperty (const QString &subResource, int propId, const QVariant &value) |
virtual entryId | insertEntry (const QString &subResource, const KLFLibEntry &entry) |
Insert an entry into this resource. More... | |
virtual entryId | insertEntry (const KLFLibEntry &entry) |
Insert an entry into this resource. More... | |
virtual QList< entryId > | insertEntries (const QString &subResource, const KLFLibEntryList &entrylist)=0 |
Insert new entries in this resource. More... | |
virtual QList< entryId > | insertEntries (const KLFLibEntryList &entrylist) |
Insert new entries in this resource. More... | |
virtual bool | changeEntries (const QString &subResource, const QList< entryId > &idlist, const QList< int > &properties, const QList< QVariant > &values)=0 |
Change some entries in this resource. More... | |
virtual bool | changeEntries (const QList< entryId > &idlist, const QList< int > &properties, const QList< QVariant > &values) |
Change some entries in this resource. More... | |
virtual bool | deleteEntries (const QString &subResource, const QList< entryId > &idlist)=0 |
Delete some entries in this resource. More... | |
virtual bool | deleteEntries (const QList< entryId > &idList) |
Delete some entries in this resource. More... | |
virtual bool | saveTo (const QUrl &newPath) |
virtual bool | setResourceProperty (int propId, const QVariant &value) |
Set a resource property to the given value. More... | |
virtual bool | loadResourceProperty (const QString &propName, const QVariant &value) |
Set the given property to the given value. More... | |
![]() | |
void | dataChanged (const QString &subResource, int modificationType, const QList< KLFLib::entryId > &entryIdList) |
Emitted when data has changed. More... | |
void | defaultSubResourceChanged (const QString &newDefaultSubResource) |
Emitted when the default sub-resource changes. More... | |
void | resourcePropertyChanged (int propId) |
Emitted when a resource property changes. More... | |
void | subResourcePropertyChanged (const QString &subResource, int propId) |
Emitted when a sub-resource property changes. More... | |
void | subResourceCreated (const QString &newSubResource) |
Emitted when a sub-resource is created. More... | |
void | subResourceRenamed (const QString &oldSubResourceName, const QString &newSubResourceName) |
Emitted when a sub-resource is renamed. More... | |
void | subResourceDeleted (const QString &subResource) |
Emitted when a sub-resource is deleted. More... | |
void | operationStartReportingProgress (KLFProgressReporter *progressReporter, const QString &descriptiveText) |
![]() | |
ToStringUseHtml | |
ToStringUseHtmlDiv | |
ToStringQuoteValues | |
ToStringAllProperties | |
![]() | |
enum | ModifyStatus { MS_CanModify = 0, MS_IsLocked = 1, MS_SubResLocked = 2, MS_NotModifiable = 3 } |
![]() | |
virtual bool | saveResourceProperty (int propId, const QVariant &value)=0 |
Save a resource property to the backend resource data. More... | |
virtual ModifyStatus | baseCanModifyStatus (bool inSubResource, const QString &subResource=QString()) const |
can modify data in resource (base common tests only) More... | |
bool | thisOperationProgressBlocked () const |
![]() | |
virtual void | propertyValueChanged (int propId, const QVariant &oldValue, const QVariant &newValue) |
virtual void | setProperty (const QString &propname, const QVariant &value) |
virtual void | setProperty (int propId, const QVariant &value) |
virtual int | loadProperty (const QString &propname, const QVariant &value) |
void | registerBuiltInProperty (int propId, const QString &propName) const |
int | registerProperty (const QString &propertyName) const |
QString | propertyNameSpace () const |
QVector< QVariant > | propertyVector () const |
![]() | |
static void | registerBuiltInProperty (const QString &propNameSpace, int propId, const QString &name) |
static int | registerProperty (const QString &propNameSpace, const QString &propertyName) |
static int | propertyMaxId (const QString &propNameSpace) |
static bool | propertyIdRegistered (const QString &propNameSpace, int propId) |
static bool | propertyNameRegistered (const QString &propNameSpace, const QString &propertyName) |
static int | propertyIdForName (const QString &propNameSpace, const QString &propertyName) |
static QString | propertyNameForId (const QString &propNameSpace, int propId) |
static QList< int > | registeredPropertyIdList (const QString &propNameSpace) |
static QStringList | registeredPropertyNameList (const QString &propNameSpace) |
static QMap< QString, int > | registeredProperties (const QString &propNameSpace) |
Provides a simple API for reading library resources.
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 (!)
|
inlinevirtual |
|
virtual |
Implements KLFLibResourceEngine.
Definition at line 897 of file klflib.cpp.
References KLFLibResourceEngine::allEntries(), and QList::size().
|
virtual |
Implements KLFLibResourceEngine.
Definition at line 914 of file klflib.cpp.
References KLFLibResourceEngine::entry(), and QList::size().
Implements KLFLibResourceEngine.
Definition at line 907 of file klflib.cpp.
References KLFLibResourceEngine::entry(), KLFLibEntry::latex(), and QString::size().
|
virtual |
Implements KLFLibResourceEngine.
Definition at line 925 of file klflib.cpp.
|
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(), and KLFLibResourceEngine::Query::skip.
Referenced by KLFLibDBEngine::query().
|
virtual |
Implements KLFLibResourceEngine.
Definition at line 932 of file klflib.cpp.
|
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().
|
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().