30 #include <QDataStream>
91 {
return latexAddCategoryTagsComment(latex(), category(), tags()); }
132 static QString normalizeCategoryPath(
const QString& categoryPath);
136 void initRegisteredProperties();
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;
771 virtual QVariant subResourceProperty(
const QString& subResource,
int propId)
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);
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;
1612 bool reference_is_rawentrylist;
1625 {
return mSorter->operator()(a, b); }
1629 {
return mSorter->operator()(a.
entry, b.
entry); }
1633 int numberOfEntries();
1656 virtual int query(
const QString& subResource,
const Query& query, QueryResult *result);
1664 const Query& query, QueryResult *result);
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;
1853 const QString& mimeType)
const = 0;
1863 static bool canDecodeMimeData(
const QMimeData *mimeData);
1865 QVariantMap *metaData);
1868 bool warnIfNotFound =
true);
1870 bool warnIfNotFound =
true);
QDataStream & operator<<(QDataStream &stream, const KLFLatexSymbol &s)
#define KLF_DEBUG_DECLARE_REF_INSTANCE(expr)
KLFLibResourceSimpleEngine(const QUrl &url, uint supportedfeatureflags, QObject *parent=NULL)
const QVariant matchValue() const
QDataStream & operator>>(QDataStream &stream, KLFLatexSymbol &s)
EntryMatchCondition(Type type)
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?
virtual QList< KLFLibEntryWithId > entries(const QString &subResource, const QList< KLFLib::entryId > &idList, const QList< int > &wantedEntryProperties=QList< int >())=0
query multiple entries in this resource
virtual bool hasEntry(const QString &subResource, entryId id)=0
query the existence of an entry in this resource
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()
static EntryMatchCondition mkMatchAll()
virtual QList< QVariant > queryValues(const QString &subResource, int entryPropId)=0
List all distinct values that a property takes in all entries.
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
static EntryMatchCondition mkOrMatch(QList< EntryMatchCondition > conditions)
virtual QList< KLFLib::entryId > allIds()
Returns all IDs in this resource (and the default sub-resource)
QList< KLFLib::entryId > entryIdList
virtual int query(const QString &subResource, const Query &query, QueryResult *result)=0
query entries in this resource with specified property values
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.
static EntryMatchCondition mkPropertyMatch(PropertyMatch pmatch)
The Category to which eq. belongs (path-style string)
QueryResult(uint fill_flags=0x00)
static EntryMatchCondition mkAndMatch(QList< EntryMatchCondition > conditions)
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
entries have to match with all given conditions
A structure that will hold the result of a query() query.
static EntryMatchCondition mkNegateMatch(const EntryMatchCondition &condition)
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)
virtual QStringList supportedTypes() const =0
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)