30 #include <QDataStream> 91 {
return latexAddCategoryTagsComment(latex(), category(), tags()); }
132 static QString normalizeCategoryPath(
const QString& categoryPath);
136 void initRegisteredProperties();
165 : mFlags(flags), mValue(value), mValueString(value.toString()) { }
173 inline const Qt::MatchFlags
matchFlags()
const {
return mFlags; }
291 inline bool isValid()
const {
return (pPropId >= 0); }
294 inline int propId()
const {
return pPropId; }
296 inline Qt::SortOrder
order()
const {
return pOrder; }
299 virtual void setPropId(
int propId);
301 virtual void setOrder(Qt::SortOrder order);
316 int propId, Qt::SortOrder order)
const;
328 Qt::SortOrder pOrder;
449 : id(i), entry(e) { }
471 SubResPropLocked = 1,
472 SubResPropViewType = 2
491 FeatureReadOnly = 0x0001,
500 FeatureLocked = 0x0002,
504 FeatureSaveTo = 0x0004,
508 FeatureSubResources = 0x0008,
515 FeatureSubResourceProps = 0x0010,
555 WantUrlDefaultSubResource = 0x01,
557 WantUrlReadOnly = 0x02
571 virtual QUrl url(uint flags = 0x0)
const;
591 virtual uint compareUrlTo(
const QUrl& other, uint interestFlags = 0xfffffff)
const = 0;
635 UnknownModification = 0,
662 virtual bool canModifyData(
const QString& subResource,
ModifyType modifytype)
const;
678 virtual bool canModifyData(
ModifyType modifytype)
const;
692 virtual bool canModifyProp(
int propId)
const;
700 virtual bool canRegisterProperty(
const QString& propName)
const;
718 virtual bool hasSubResource(
const QString& subResource)
const;
729 virtual QString defaultSubResource()
const;
739 virtual bool compareDefaultSubResourceEquals(
const QString& subResourceName)
const;
747 virtual bool canCreateSubResource()
const;
756 virtual bool canRenameSubResource(
const QString& subResource)
const;
765 virtual bool canDeleteSubResource(
const QString& subResource)
const;
794 virtual QString subResourcePropertyName(
int propId)
const;
809 virtual bool canModifySubResourceProperty(
const QString& subResource,
int propId)
const;
838 virtual bool hasEntry(
const QString& subResource, entryId
id) = 0;
848 virtual bool hasEntry(entryId
id);
937 : matchCondition(
KLFLib::EntryMatchCondition::mkMatchAll()),
941 orderDirection(Qt::AscendingOrder),
942 wantedEntryProperties(
QList<int>())
972 enum Flags { FillEntryIdList = 0x01, FillRawEntryList = 0x02, FillEntryWithIdList = 0x04 };
1100 void blockProgressReportingForNextOperation();
1103 void blockProgressReporting(
bool block);
1124 void dataChanged(
const QString& subResource,
int modificationType,
1128 void defaultSubResourceChanged(
const QString& newDefaultSubResource);
1132 void resourcePropertyChanged(
int propId);
1141 void subResourcePropertyChanged(
const QString& subResource,
int propId);
1147 void subResourceCreated(
const QString& newSubResource);
1153 void subResourceRenamed(
const QString& oldSubResourceName,
1154 const QString& newSubResourceName);
1160 void subResourceDeleted(
const QString& subResource);
1194 const QString& descriptiveText);
1211 virtual bool setTitle(
const QString& title);
1226 virtual bool setLocked(
bool locked);
1237 virtual bool setViewType(
const QString& viewType);
1245 virtual bool setReadOnly(
bool readonly);
1264 virtual void setDefaultSubResource(
const QString& subResource);
1282 virtual bool createSubResource(
const QString& subResource,
const QString& subResourceTitle);
1299 virtual bool createSubResource(
const QString& subResource);
1318 virtual bool renameSubResource(
const QString& oldSubResourceName,
const QString& newSubResourceName);
1333 virtual bool deleteSubResource(
const QString& subResource);
1343 virtual bool setSubResourceProperty(
const QString& subResource,
int propId,
const QVariant& value);
1368 virtual entryId insertEntry(
const KLFLibEntry& entry);
1388 virtual QList<entryId> insertEntries(
const QString& subResource,
const KLFLibEntryList& entrylist) = 0;
1400 virtual QList<entryId> insertEntries(
const KLFLibEntryList& entrylist);
1474 virtual bool saveTo(
const QUrl& newPath);
1488 virtual bool setResourceProperty(
int propId,
const QVariant& value);
1500 virtual bool loadResourceProperty(
const QString& propName,
const QVariant& value);
1513 virtual bool saveResourceProperty(
int propId,
const QVariant& value) = 0;
1520 MS_SubResLocked = 2,
1521 MS_NotModifiable = 3
1539 virtual ModifyStatus baseCanModifyStatus(
bool inSubResource,
1542 bool thisOperationProgressBlocked()
const;
1545 void initRegisteredProperties();
1553 mutable bool pProgressBlocked;
1554 bool pThisOperationProgressBlockedOnly;
1601 virtual bool hasEntry(
const QString&, entryId
id);
1612 bool reference_is_rawentrylist;
1625 {
return mSorter->operator()(a, b); }
1629 {
return mSorter->operator()(a.
entry, b.
entry); }
1633 int numberOfEntries();
1722 virtual uint schemeFunctions(
const QString& scheme)
const;
1733 virtual QString correspondingWidgetType(
const QString& scheme)
const = 0;
1848 virtual QStringList supportedEncodingMimeTypes()
const = 0;
1850 virtual QStringList supportedDecodingMimeTypes()
const = 0;
1852 virtual QByteArray encodeMime(
const KLFLibEntryList& entryList,
const QVariantMap& metaData,
1853 const QString& mimeType)
const = 0;
1856 KLFLibEntryList *entryList, QVariantMap *metaData)
const = 0;
1862 static QMimeData *createMimeData(
const KLFLibEntryList& entryList,
const QVariantMap& metaData);
1863 static bool canDecodeMimeData(
const QMimeData *mimeData);
1864 static bool decodeMimeData(
const QMimeData *mimeData, KLFLibEntryList *entryList,
1865 QVariantMap *metaData);
1868 bool warnIfNotFound =
true);
1870 bool warnIfNotFound =
true);
#define KLF_DEBUG_DECLARE_REF_INSTANCE(expr)
KLFLibResourceSimpleEngine(const QUrl &url, uint supportedfeatureflags, QObject *parent=NULL)
const QVariant matchValue() const
KLF_EXPORT QDataStream & operator<<(QDataStream &stream, const KLFLibResourceEngine::KLFLibEntryWithId &entrywid)
EntryMatchCondition(Type type)
PropertyMatch(int propId=-1, const StringMatch &match=StringMatch())
A structure that describes a query for query()
A cached value of the size of value in Preview.
const Qt::MatchFlags matchFlags() const
entries have to match with one of a list of conditions
qint32 entryId
An entry ID.
QList< KLFLibEntry > KLFLibEntryList
virtual bool locked() const
Is this resource is locked?
QString latexWithCategoryTagsComments() const
virtual void setProperty(const QString &propname, const QVariant &value)
Qt::SortOrder orderDirection
void setStyle(const KLFStyle &style)
Matches entries that don't match a condition.
virtual QList< int > subResourcePropertyIdList() const
QMap< QString, QVariant > Parameters
WantUrlFormatFlag
Format options one can give to url()
KLFLibEntryWithId(entryId i=-1, const KLFLibEntry &e=KLFLibEntry())
Helper class to sort entries into a KLFLibResourceEngine::QueryResult.
void setCategory(const QString &s)
QList< KLFLibEntryWithId > entryWithIdList
virtual bool isReadOnly() const
query read-only state
StringMatch(const QVariant &value=QVariant(), Qt::MatchFlags flags=Qt::MatchExactly)
Contains general definitions to be used anywhere in the KLFLib* framework.
QList< KLFLib::entryId > entryIdList
virtual ~KLFLibResourceSimpleEngine()
const QString matchValueString() const
Qt::SortOrder order() const
The currently set sorting order.
void setDateTime(const QDateTime &dt)
virtual bool accessShared() const
If the resource is accessed by many clients.
int propId() const
The currently set property that will be queried in the items we're sorting.
KLFLibEntryList rawEntryList
ResourceFeature
Features that may or may not be implemented by subclasses.
The Category to which eq. belongs (path-style string)
QueryResult(uint fill_flags=0x00)
void setPreviewSize(const QSize &sz)
void setTags(const QString &s)
virtual uint supportedFeatureFlags() const
List of features supported by this resource engine.
bool operator()(const KLFLibEntryWithId &a, const KLFLibEntryWithId &b)
Compares KLFLibResourceEngine::KLFLibEntryWithId's.
virtual QStringList subResourceList() const
Tags about the equation (string)
virtual QString viewType() const
The (last) View Type used to display this resource.
fromValue(const T &value)
virtual QString title() const
The human-set title of this resource.
Provides a simple API for reading library resources.
bool operator()(const KLFLibEntry &a, const KLFLibEntry &b)
Compares KLFLibEntry'ies.
QList< EntryMatchCondition > mConditionList
A structure that will hold the result of a query() query.
An entry (single formula) in the library.
QList< int > wantedEntryProperties
An Image Preview of equation (scaled down QImage)
Matches a property ID with a string (with a StringMatch)
Helper class to encode an entry list as mime data (abstract interface)
virtual QVariant property(const QString &propName) const
PropertyMatch(const PropertyMatch &other)
A KLFLibEntry in combination with a KLFLib::entryId.
PropertyMatch mPropertyMatch
void setPreview(const QImage &img)
Utility class for sorting library entry items.
Type type() const
Get which type of condition this is.
QDateTime dateTime() const
virtual QString suggestedViewTypeIdentifier() const
An abstract resource engine.
The Date/Time at which the equation was evaluated.
KLFLib::EntryMatchCondition matchCondition
StringMatch(const StringMatch &m)
KLF_EXPORT QDataStream & operator>>(QDataStream &stream, KLFLibResourceEngine::KLFLibEntryWithId &entrywid)
PropertyMatch propertyMatch() const
Relevant for type PropertyMatchType.
QSize previewSize() const
QList< EntryMatchCondition > conditionList() const
Relevant for types OrMatchType and AndMatchType.
void setLatex(const QString &latex)