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

Provides a simple API for reading library resources. More...

#include <klflib.h>

Inheritance diagram for KLFLibResourceSimpleEngine:
Inheritance graph
[legend]
Collaboration diagram for KLFLibResourceSimpleEngine:
Collaboration graph
[legend]

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::entryIdallIds (const QString &subResource)
 
virtual bool hasEntry (const QString &, entryId id)
 
virtual QList< KLFLibEntryWithIdentries (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< QVariantqueryValues (const QString &subResource, int entryPropId)
 
- Public Member Functions inherited from KLFLibResourceEngine
 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< KLFLibEntryWithIdentries (const QList< KLFLib::entryId > &idList, const QList< int > &wantedEntryProperties=QList< int >())
 query multiple entries in this resource More...
 
virtual QList< KLFLib::entryIdallIds ()
 Returns all IDs in this resource (and the default sub-resource) More...
 
virtual QList< KLFLibEntryWithIdallEntries (const QString &subResource, const QList< int > &wantedEntryProperties=QList< int >())=0
 query all entries in this resource More...
 
virtual QList< KLFLibEntryWithIdallEntries (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...
 
- Public Member Functions inherited from QObject
 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 &regExp)
 
 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)
 
- Public Member Functions inherited from KLFPropertizedObject
 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, QVariantallProperties () 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< QVariantqueryValuesImpl (KLFLibResourceEngine *resource, const QString &subResource, int entryPropId)
 
static bool testEntryMatchConditionImpl (const KLFLib::EntryMatchCondition &condition, const KLFLibEntry &libentry)
 

Additional Inherited Members

- Public Types inherited from KLFLibResourceEngine
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
 
- Public Types inherited from KLFPropertizedObject
enum  ToStringFlag
 
- Public Slots inherited from KLFLibResourceEngine
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< entryIdinsertEntries (const QString &subResource, const KLFLibEntryList &entrylist)=0
 Insert new entries in this resource. More...
 
virtual QList< entryIdinsertEntries (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...
 
- Signals inherited from KLFLibResourceEngine
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)
 
- Protected Types inherited from KLFLibResourceEngine
enum  ModifyStatus { MS_CanModify = 0, MS_IsLocked = 1, MS_SubResLocked = 2, MS_NotModifiable = 3 }
 
- Protected Member Functions inherited from KLFLibResourceEngine
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
 
- Protected Member Functions inherited from KLFPropertizedObject
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< QVariantpropertyVector () const
 
- Static Protected Member Functions inherited from KLFPropertizedObject
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)
 

Detailed Description

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 (!)

Definition at line 1588 of file klflib.h.

Constructor & Destructor Documentation

KLFLibResourceSimpleEngine::KLFLibResourceSimpleEngine ( const QUrl url,
uint  supportedfeatureflags,
QObject parent = NULL 
)
inline

Definition at line 1592 of file klflib.h.

virtual KLFLibResourceSimpleEngine::~KLFLibResourceSimpleEngine ( )
inlinevirtual

Definition at line 1596 of file klflib.h.

Member Function Documentation

QList< KLFLib::entryId > KLFLibResourceSimpleEngine::allIds ( const QString subResource)
virtual

Implements KLFLibResourceEngine.

Definition at line 897 of file klflib.cpp.

References QList::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 QList::size().

bool KLFLibResourceSimpleEngine::hasEntry ( const QString subResource,
entryId  id 
)
virtual
Bug:
............... BUG/TODO .......... concept problem here

Implements KLFLibResourceEngine.

Definition at line 907 of file klflib.cpp.

int KLFLibResourceSimpleEngine::query ( const QString subResource,
const Query query,
QueryResult result 
)
virtual

Implements KLFLibResourceEngine.

Definition at line 925 of file klflib.cpp.

int KLFLibResourceSimpleEngine::queryImpl ( KLFLibResourceEngine resource,
const QString subResource,
const Query query,
QueryResult result 
)
static
QList< QVariant > KLFLibResourceSimpleEngine::queryValues ( const QString subResource,
int  entryPropId 
)
virtual

Implements KLFLibResourceEngine.

Definition at line 932 of file klflib.cpp.

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

bool KLFLibResourceSimpleEngine::testEntryMatchConditionImpl ( const KLFLib::EntryMatchCondition condition,
const KLFLibEntry libentry 
)
static

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

Generated by doxygen 1.8.8