[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project
klflib.h
Go to the documentation of this file.
1 /***************************************************************************
2  * file klflib.h
3  * This file is part of the KLatexFormula Project.
4  * Copyright (C) 2011 by Philippe Faist
5  * philippe.faist at bluewin.ch
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  ***************************************************************************/
22 /* $Id: klflib.h 603 2011-02-26 23:14:55Z phfaist $ */
23 
24 #ifndef KLFLIB_H
25 #define KLFLIB_H
26 
27 #include <QImage>
28 #include <QMap>
29 #include <QUrl>
30 #include <QDataStream>
31 #include <QDateTime>
32 #include <QFileInfo>
33 
34 #include <klfdefs.h>
35 #include <klfbackend.h>
36 
37 #include <klfpobj.h>
38 #include <klffactory.h>
39 #include <klfstyle.h>
40 
41 
42 
44 
45 
46 
55 class KLF_EXPORT KLFLibEntry : public KLFPropertizedObject {
56 public:
61  enum PropertyId {
62  Latex = 0,
67  Tags,
68  Style
69  };
70 
71  KLFLibEntry(const QString& latex = QString(), const QDateTime& dt = QDateTime(),
72  const QImage& preview = QImage(), const QSize& previewsize = QSize(),
73  const QString& category = QString(), const QString& tags = QString(),
74  const KLFStyle& style = KLFStyle());
77  KLFLibEntry(const QString& latex, const QDateTime& dt, const QImage& preview,
78  const KLFStyle& style);
79  KLFLibEntry(const KLFLibEntry& copy);
80  virtual ~KLFLibEntry();
81 
82  inline QString latex() const { return property(Latex).toString(); }
83  inline QDateTime dateTime() const { return property(DateTime).toDateTime(); }
84  inline QImage preview() const { return property(Preview).value<QImage>(); }
85  inline QSize previewSize() const { return property(PreviewSize).value<QSize>(); }
86  inline QString category() const { return property(Category).toString(); }
87  inline QString tags() const { return property(Tags).toString(); }
88  inline KLFStyle style() const { return property(Style).value<KLFStyle>(); }
89 
91  { return latexAddCategoryTagsComment(latex(), category(), tags()); }
92 
93  inline void setLatex(const QString& latex) { setProperty(Latex, latex); }
94  inline void setDateTime(const QDateTime& dt) { setProperty(DateTime, dt); }
95  inline void setPreview(const QImage& img) { setProperty(Preview, img); }
96  inline void setPreviewSize(const QSize& sz) { setProperty(PreviewSize, sz); }
101  inline void setCategory(const QString& s) { setProperty(Category, normalizeCategoryPath(s)); }
102  inline void setTags(const QString& s) { setProperty(Tags, s); }
103  inline void setStyle(const KLFStyle& style) { setProperty(Style, QVariant::fromValue(style)); }
104 
111  int setEntryProperty(const QString& propName, const QVariant& value);
112 
113 
116  static QString categoryFromLatex(const QString& latex);
118  static QString tagsFromLatex(const QString& latex);
120  static QString stripCategoryTagsFromLatex(const QString& latex);
122  static QString latexAddCategoryTagsComment(const QString& latex, const QString& category,
123  const QString& tags);
132  static QString normalizeCategoryPath(const QString& categoryPath);
133 
134 private:
135 
136  void initRegisteredProperties();
137 };
138 
140  ;
141 
143 
144 
146 namespace KLFLib {
148 
156  typedef qint32 entryId;
157 
158 
163  struct StringMatch {
164  StringMatch(const QVariant& value = QVariant(), Qt::MatchFlags flags = Qt::MatchExactly)
165  : mFlags(flags), mValue(value), mValueString(value.toString()) { }
167 
173  inline const Qt::MatchFlags matchFlags() const { return mFlags; }
175  inline const QVariant matchValue() const { return mValue; }
178  inline const QString matchValueString() const { return mValueString; }
179 
180  protected:
181  Qt::MatchFlags mFlags;
184  };
185 
190  struct PropertyMatch : public StringMatch {
192  PropertyMatch(int propId = -1, const StringMatch& match = StringMatch())
193  : StringMatch(match), mPropertyId(propId) { }
195  PropertyMatch(const PropertyMatch& other) : StringMatch(other), mPropertyId(other.mPropertyId) { }
196 
198  inline int propertyId() const { return mPropertyId; }
199 
200  protected:
202  };
203 
215  {
216  enum Type {
222  };
223 
225  inline Type type() const { return mType; }
227  inline PropertyMatch propertyMatch() const { return mPropertyMatch; }
230 
234  static EntryMatchCondition mkNegateMatch(const EntryMatchCondition& condition);
237 
238  protected:
240 
242 
245  };
246 
247 }
248 
250 
276 class KLF_EXPORT KLFLibEntrySorter
277 {
278 public:
279  KLFLibEntrySorter(int propId = -1, Qt::SortOrder order = Qt::AscendingOrder);
288  KLFLibEntrySorter(const KLFLibEntrySorter *clone);
289  virtual ~KLFLibEntrySorter();
290 
291  inline bool isValid() const { return (pPropId >= 0); }
292 
294  inline int propId() const { return pPropId; }
296  inline Qt::SortOrder order() const { return pOrder; }
297 
299  virtual void setPropId(int propId);
301  virtual void setOrder(Qt::SortOrder order);
302 
304  virtual QString entryValue(const KLFLibEntry& entry, int propId) const;
305 
307 
315  virtual bool compareLessThan(const KLFLibEntry& a, const KLFLibEntry& b,
316  int propId, Qt::SortOrder order) const;
317 
321  virtual bool operator()(const KLFLibEntry& a, const KLFLibEntry& b) const;
322 
323 
324 private:
325  const KLFLibEntrySorter * pCloneOf;
326 
327  int pPropId;
328  Qt::SortOrder pOrder;
329 };
330 
331 
332 
440 class KLF_EXPORT KLFLibResourceEngine : public QObject, public KLFPropertizedObject
441 {
442  Q_OBJECT
443 public:
445 
448  KLFLibEntryWithId(entryId i = -1, const KLFLibEntry& e = KLFLibEntry())
449  : id(i), entry(e) { }
450  entryId id;
452  };
453 
457  PropTitle = 0,
460  PropAccessShared
461  };
462 
470  SubResPropTitle = 0,
471  SubResPropLocked = 1,
472  SubResPropViewType = 2
473  };
474 
476 
488 
491  FeatureReadOnly = 0x0001,
493 
500  FeatureLocked = 0x0002,
502 
504  FeatureSaveTo = 0x0004,
506 
508  FeatureSubResources = 0x0008,
510 
515  FeatureSubResourceProps = 0x0010,
516  };
517 
538  KLFLibResourceEngine(const QUrl& url, uint supportedfeatureflags, QObject *parent = NULL);
539 
540  virtual ~KLFLibResourceEngine();
541 
543 
550  virtual uint supportedFeatureFlags() const { return pFeatureFlags; }
551 
555  WantUrlDefaultSubResource = 0x01,
557  WantUrlReadOnly = 0x02
558  };
560 
571  virtual QUrl url(uint flags = 0x0) const;
572 
574 
591  virtual uint compareUrlTo(const QUrl& other, uint interestFlags = 0xfffffff) const = 0;
592 
594 
595  virtual bool isReadOnly() const { return pReadOnly; }
596 
598 
599  virtual QString title() const { return KLFPropertizedObject::property(PropTitle).toString(); }
600 
602 
610  virtual bool locked() const { return KLFPropertizedObject::property(PropLocked).toBool(); }
611 
613  virtual QString viewType() const
614  { return KLFPropertizedObject::property(PropViewType).toString(); }
615 
617 
622  virtual bool accessShared() const
623  { return KLFPropertizedObject::property(PropAccessShared).toBool(); }
624 
626 
631  virtual QVariant resourceProperty(const QString& name) const;
632 
633  enum ModifyType {
634  AllActionsData = 0,
635  UnknownModification = 0,
638  DeleteData
639  };
640 
662  virtual bool canModifyData(const QString& subResource, ModifyType modifytype) const;
663 
678  virtual bool canModifyData(ModifyType modifytype) const;
679 
692  virtual bool canModifyProp(int propId) const;
693 
700  virtual bool canRegisterProperty(const QString& propName) const;
701 
704  virtual QString suggestedViewTypeIdentifier() const { return QString(); }
705 
718  virtual bool hasSubResource(const QString& subResource) const;
719 
722  virtual QStringList subResourceList() const { return QStringList(); }
723 
729  virtual QString defaultSubResource() const;
730 
739  virtual bool compareDefaultSubResourceEquals(const QString& subResourceName) const;
740 
747  virtual bool canCreateSubResource() const;
748 
756  virtual bool canRenameSubResource(const QString& subResource) const;
757 
765  virtual bool canDeleteSubResource(const QString& subResource) const;
766 
771  virtual QVariant subResourceProperty(const QString& subResource, int propId) const;
772 
780  virtual QList<int> subResourcePropertyIdList() const { return QList<int>(); }
781 
794  virtual QString subResourcePropertyName(int propId) const;
795 
809  virtual bool canModifySubResourceProperty(const QString& subResource, int propId) const;
810 
812 
821  virtual KLFLibEntry entry(const QString& subResource, entryId id) = 0;
822 
824 
830  virtual KLFLibEntry entry(entryId id);
831 
833 
838  virtual bool hasEntry(const QString& subResource, entryId id) = 0;
839 
841 
848  virtual bool hasEntry(entryId id);
849 
851 
870  virtual QList<KLFLibEntryWithId> entries(const QString& subResource,
871  const QList<KLFLib::entryId>& idList,
872  const QList<int>& wantedEntryProperties = QList<int>()) = 0;
873 
875 
896  virtual QList<KLFLibEntryWithId> entries(const QList<KLFLib::entryId>& idList,
897  const QList<int>& wantedEntryProperties = QList<int>());
898 
899 
933  struct Query
934  {
937  : matchCondition(KLFLib::EntryMatchCondition::mkMatchAll()),
938  skip(0),
939  limit(-1),
940  orderPropId(-1),
941  orderDirection(Qt::AscendingOrder),
942  wantedEntryProperties(QList<int>())
943  {
944  }
945 
947  int skip;
948  int limit;
950  Qt::SortOrder orderDirection;
952  };
953 
970  struct QueryResult
971  {
972  enum Flags { FillEntryIdList = 0x01, FillRawEntryList = 0x02, FillEntryWithIdList = 0x04 };
973 
976  QueryResult(uint fill_flags = 0x00) : fillFlags(fill_flags) { }
977  uint fillFlags;
978 
980  KLFLibEntryList rawEntryList;
982  };
983 
984 
986 
1036  virtual int query(const QString& subResource, const Query& query, QueryResult *result) = 0;
1037 
1038 
1056  virtual QList<QVariant> queryValues(const QString& subResource, int entryPropId) = 0;
1057 
1058 
1060 
1065  virtual QList<KLFLib::entryId> allIds(const QString& subResource) = 0;
1066 
1068 
1077  virtual QList<KLFLib::entryId> allIds();
1078 
1080 
1085  virtual QList<KLFLibEntryWithId> allEntries(const QString& subResource,
1086  const QList<int>& wantedEntryProperties = QList<int>()) = 0;
1087 
1089 
1096  virtual QList<KLFLibEntryWithId> allEntries(const QList<int>& wantedEntryProperties = QList<int>());
1097 
1098 
1100  void blockProgressReportingForNextOperation();
1101 
1103  void blockProgressReporting(bool block);
1104 
1105 signals:
1107 
1124  void dataChanged(const QString& subResource, int modificationType,
1125  const QList<KLFLib::entryId>& entryIdList);
1126 
1128  void defaultSubResourceChanged(const QString& newDefaultSubResource);
1129 
1131 
1132  void resourcePropertyChanged(int propId);
1133 
1135 
1141  void subResourcePropertyChanged(const QString& subResource, int propId);
1142 
1144 
1147  void subResourceCreated(const QString& newSubResource);
1148 
1150 
1153  void subResourceRenamed(const QString& oldSubResourceName,
1154  const QString& newSubResourceName);
1155 
1157 
1160  void subResourceDeleted(const QString& subResource);
1161 
1162 
1193  void operationStartReportingProgress(KLFProgressReporter *progressReporter,
1194  const QString& descriptiveText);
1195 
1196 
1197 
1198 public slots:
1199 
1201 
1211  virtual bool setTitle(const QString& title);
1212 
1214 
1226  virtual bool setLocked(bool locked);
1227 
1237  virtual bool setViewType(const QString& viewType);
1238 
1240 
1245  virtual bool setReadOnly(bool readonly);
1246 
1248 
1264  virtual void setDefaultSubResource(const QString& subResource);
1265 
1267 
1282  virtual bool createSubResource(const QString& subResource, const QString& subResourceTitle);
1283 
1285 
1299  virtual bool createSubResource(const QString& subResource);
1300 
1318  virtual bool renameSubResource(const QString& oldSubResourceName, const QString& newSubResourceName);
1319 
1333  virtual bool deleteSubResource(const QString& subResource);
1334 
1335 
1343  virtual bool setSubResourceProperty(const QString& subResource, int propId, const QVariant& value);
1344 
1345 
1347 
1356  virtual entryId insertEntry(const QString& subResource, const KLFLibEntry& entry);
1357 
1359 
1368  virtual entryId insertEntry(const KLFLibEntry& entry);
1369 
1371 
1388  virtual QList<entryId> insertEntries(const QString& subResource, const KLFLibEntryList& entrylist) = 0;
1389 
1391 
1400  virtual QList<entryId> insertEntries(const KLFLibEntryList& entrylist);
1401 
1403 
1421  virtual bool changeEntries(const QString& subResource, const QList<entryId>& idlist,
1422  const QList<int>& properties, const QList<QVariant>& values) = 0;
1423 
1425 
1433  virtual bool changeEntries(const QList<entryId>& idlist, const QList<int>& properties,
1434  const QList<QVariant>& values);
1435 
1437 
1452  virtual bool deleteEntries(const QString& subResource, const QList<entryId>& idlist) = 0;
1453 
1455 
1463  virtual bool deleteEntries(const QList<entryId>& idList);
1464 
1474  virtual bool saveTo(const QUrl& newPath);
1475 
1477 
1488  virtual bool setResourceProperty(int propId, const QVariant& value);
1489 
1491 
1500  virtual bool loadResourceProperty(const QString& propName, const QVariant& value);
1501 
1502 
1503 protected:
1504 
1506 
1513  virtual bool saveResourceProperty(int propId, const QVariant& value) = 0;
1514 
1518  MS_CanModify = 0,
1519  MS_IsLocked = 1,
1520  MS_SubResLocked = 2,
1521  MS_NotModifiable = 3
1522  };
1523 
1525 
1539  virtual ModifyStatus baseCanModifyStatus(bool inSubResource,
1540  const QString& subResource = QString()) const;
1541 
1542  bool thisOperationProgressBlocked() const;
1543 
1544 private:
1545  void initRegisteredProperties();
1546 
1547  QUrl pUrl;
1548  uint pFeatureFlags;
1549  bool pReadOnly;
1550 
1551  QString pDefaultSubResource;
1552 
1553  mutable bool pProgressBlocked;
1554  bool pThisOperationProgressBlockedOnly;
1555 
1556  KLF_DEBUG_DECLARE_REF_INSTANCE( QFileInfo(url().path()).fileName()+":"+defaultSubResource() ) ;
1557 };
1558 
1559 
1561  ;
1562 
1563 
1564 KLF_EXPORT QDataStream& operator<<(QDataStream& stream,
1565  const KLFLibResourceEngine::KLFLibEntryWithId& entrywid);
1566 KLF_EXPORT QDataStream& operator>>(QDataStream& stream,
1568 
1569 
1589 {
1590  Q_OBJECT
1591 public:
1592  KLFLibResourceSimpleEngine(const QUrl& url, uint supportedfeatureflags, QObject *parent = NULL)
1593  : KLFLibResourceEngine(url, supportedfeatureflags, parent)
1594  {
1595  }
1597 
1598  // these functions are implemented using the other base functions.
1599 
1600  virtual QList<KLFLib::entryId> allIds(const QString& subResource);
1601  virtual bool hasEntry(const QString&, entryId id);
1602  virtual QList<KLFLibEntryWithId> entries(const QString&, const QList<KLFLib::entryId>& idList,
1603  const QList<int>& wantedEntryProperties = QList<int>());
1604 
1608  {
1609  KLFLibEntrySorter *mSorter;
1610  QueryResult *mResult;
1611  uint fillflags;
1612  bool reference_is_rawentrylist;
1613  public:
1620 
1621  /* QueryResultListSorter(const QueryResultListSorter& other); */
1622 
1624  inline bool operator()(const KLFLibEntry& a, const KLFLibEntry& b)
1625  { return mSorter->operator()(a, b); }
1626 
1628  inline bool operator()(const KLFLibEntryWithId& a, const KLFLibEntryWithId& b)
1629  { return mSorter->operator()(a.entry, b.entry); }
1630 
1633  int numberOfEntries();
1634 
1653  void insertIntoOrderedResult(const KLFLibEntryWithId& entry);
1654  };
1655 
1656  virtual int query(const QString& subResource, const Query& query, QueryResult *result);
1657 
1658  virtual QList<QVariant> queryValues(const QString& subResource, int entryPropId);
1659 
1660 
1663  static int queryImpl(KLFLibResourceEngine *resource, const QString& subResource,
1664  const Query& query, QueryResult *result);
1665 
1668  static QList<QVariant> queryValuesImpl(KLFLibResourceEngine *resource, const QString& subResource,
1669  int entryPropId);
1670 
1671 
1673  static bool testEntryMatchConditionImpl(const KLFLib::EntryMatchCondition& condition,
1674  const KLFLibEntry& libentry);
1675 };
1676 
1677 
1678 
1685 class KLF_EXPORT KLFLibEngineFactory : public QObject, public KLFFactoryBase
1686 {
1687  Q_OBJECT
1688 public:
1694 
1696  FuncOpen = 0x01,
1697  FuncCreate = 0x02,
1698  FuncSaveTo = 0x04
1699  };
1700 
1702  KLFLibEngineFactory(QObject *parent = NULL);
1704  virtual ~KLFLibEngineFactory();
1705 
1711  virtual QStringList supportedTypes() const = 0;
1712 
1722  virtual uint schemeFunctions(const QString& scheme) const;
1723 
1726  virtual QString schemeTitle(const QString& scheme) const = 0;
1727 
1733  virtual QString correspondingWidgetType(const QString& scheme) const = 0;
1734 
1738  virtual KLFLibResourceEngine *openResource(const QUrl& location, QObject *parent = NULL) = 0;
1739 
1741 
1758  virtual KLFLibResourceEngine *createResource(const QString& scheme, const Parameters& parameters,
1759  QObject *parent = NULL);
1760 
1762 
1779  virtual bool saveResourceTo(KLFLibResourceEngine *resource, const QUrl& newLocation);
1780 
1781 
1782 
1783 
1790  static KLFLibEngineFactory *findFactoryFor(const QUrl& url);
1791 
1794  static KLFLibEngineFactory *findFactoryFor(const QString& urlScheme);
1795 
1797  static QStringList allSupportedSchemes();
1798 
1801  static KLFLibResourceEngine *openURL(const QUrl& location, QObject *parent = NULL);
1802 
1816  static QStringList listSubResources(const QUrl& url);
1817 
1827  static QMap<QString,QString> listSubResourcesWithTitles(const QUrl& url);
1828 
1829 private:
1830  static KLFFactoryManager pFactoryManager;
1831 };
1832 
1833 
1834 
1835 // -------------------------
1836 
1837 
1838 class QMimeData;
1839 
1842 {
1843 public:
1845  virtual ~KLFAbstractLibEntryMimeEncoder();
1846 
1848  virtual QStringList supportedEncodingMimeTypes() const = 0;
1850  virtual QStringList supportedDecodingMimeTypes() const = 0;
1851 
1852  virtual QByteArray encodeMime(const KLFLibEntryList& entryList, const QVariantMap& metaData,
1853  const QString& mimeType) const = 0;
1854 
1855  virtual bool decodeMime(const QByteArray& data, const QString& mimeType,
1856  KLFLibEntryList *entryList, QVariantMap *metaData) const = 0;
1857 
1858 
1859  static QStringList allEncodingMimeTypes();
1860  static QStringList allDecodingMimeTypes();
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);
1866 
1867  static KLFAbstractLibEntryMimeEncoder *findEncoderFor(const QString& mimeType,
1868  bool warnIfNotFound = true);
1869  static KLFAbstractLibEntryMimeEncoder *findDecoderFor(const QString& mimeType,
1870  bool warnIfNotFound = true);
1871  static QList<KLFAbstractLibEntryMimeEncoder*> encoderList();
1872 private:
1873 
1874  static void registerEncoder(KLFAbstractLibEntryMimeEncoder *encoder);
1875 
1876  static QList<KLFAbstractLibEntryMimeEncoder*> staticEncoderList;
1877 };
1878 
1879 
1880 
1881 
1882 
1883 #ifdef KLF_DEBUG
1884 #include <QDebug>
1885 KLF_EXPORT QDebug& operator<<(QDebug& dbg, const KLFLib::StringMatch& smatch);
1886 KLF_EXPORT QDebug& operator<<(QDebug& dbg, const KLFLib::PropertyMatch& pmatch);
1887 KLF_EXPORT QDebug& operator<<(QDebug& dbg, const KLFLib::EntryMatchCondition& c);
1888 KLF_EXPORT QDebug& operator<<(QDebug& dbg, const KLFLibResourceEngine::Query& q);
1889 KLF_EXPORT QDebug& operator<<(QDebug& dbg, const KLFLibResourceEngine::KLFLibEntryWithId& ewid);
1890 #endif
1891 
1892 
1893 
1894 
1895 #endif
1896 
#define KLF_DEBUG_DECLARE_REF_INSTANCE(expr)
KLFLibResourceSimpleEngine(const QUrl &url, uint supportedfeatureflags, QObject *parent=NULL)
Definition: klflib.h:1592
const QVariant matchValue() const
Definition: klflib.h:175
KLF_EXPORT QDataStream & operator<<(QDataStream &stream, const KLFLibResourceEngine::KLFLibEntryWithId &entrywid)
Definition: klflib.cpp:817
EntryMatchCondition(Type type)
Definition: klflib.h:239
PropertyMatch(int propId=-1, const StringMatch &match=StringMatch())
Definition: klflib.h:192
A structure that describes a query for query()
Definition: klflib.h:933
A cached value of the size of value in Preview.
Definition: klflib.h:65
const Qt::MatchFlags matchFlags() const
Definition: klflib.h:173
entries have to match with one of a list of conditions
Definition: klflib.h:220
qint32 entryId
An entry ID.
Definition: klflib.h:156
QList< KLFLibEntry > KLFLibEntryList
Definition: klflib.h:140
virtual bool locked() const
Is this resource is locked?
Definition: klflib.h:610
KLFLib::entryId entryId
Definition: klflib.h:444
Q_DECLARE_METATYPE(KLFUnitChooser::Unit)
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
Definition: klflib.h:90
virtual void setProperty(const QString &propname, const QVariant &value)
Qt::SortOrder orderDirection
Definition: klflib.h:950
void setStyle(const KLFStyle &style)
Definition: klflib.h:103
Matches entries that don't match a condition.
Definition: klflib.h:219
QString mValueString
Definition: klflib.h:183
virtual QList< int > subResourcePropertyIdList() const
Definition: klflib.h:780
QMap< QString, QVariant > Parameters
Definition: klflib.h:1693
WantUrlFormatFlag
Format options one can give to url()
Definition: klflib.h:553
KLFLibEntryWithId(entryId i=-1, const KLFLibEntry &e=KLFLibEntry())
Definition: klflib.h:448
static EntryMatchCondition mkMatchAll()
Definition: klflib.cpp:776
QString latex() const
Definition: klflib.h:82
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.
Definition: klflib.h:1607
void setCategory(const QString &s)
Definition: klflib.h:101
QList< KLFLibEntryWithId > entryWithIdList
Definition: klflib.h:981
virtual bool isReadOnly() const
query read-only state
Definition: klflib.h:595
StringMatch(const QVariant &value=QVariant(), Qt::MatchFlags flags=Qt::MatchExactly)
Definition: klflib.h:164
static EntryMatchCondition mkOrMatch(QList< EntryMatchCondition > conditions)
Definition: klflib.cpp:795
virtual QList< KLFLib::entryId > allIds()
Returns all IDs in this resource (and the default sub-resource)
Definition: klflib.cpp:642
Contains general definitions to be used anywhere in the KLFLib* framework.
Definition: klflib.h:146
QList< KLFLib::entryId > entryIdList
Definition: klflib.h:979
Qt::MatchFlags mFlags
Definition: klflib.h:181
virtual int query(const QString &subResource, const Query &query, QueryResult *result)=0
query entries in this resource with specified property values
virtual ~KLFLibResourceSimpleEngine()
Definition: klflib.h:1596
QString category() const
Definition: klflib.h:86
int propertyId() const
Definition: klflib.h:198
const QString matchValueString() const
Definition: klflib.h:178
Qt::SortOrder order() const
The currently set sorting order.
Definition: klflib.h:296
void setDateTime(const QDateTime &dt)
Definition: klflib.h:94
virtual bool accessShared() const
If the resource is accessed by many clients.
Definition: klflib.h:622
int propId() const
The currently set property that will be queried in the items we're sorting.
Definition: klflib.h:294
KLFLibEntryList rawEntryList
Definition: klflib.h:980
ResourceFeature
Features that may or may not be implemented by subclasses.
Definition: klflib.h:486
static EntryMatchCondition mkPropertyMatch(PropertyMatch pmatch)
Definition: klflib.cpp:781
The Category to which eq. belongs (path-style string)
Definition: klflib.h:66
QueryResult(uint fill_flags=0x00)
Definition: klflib.h:976
static EntryMatchCondition mkAndMatch(QList< EntryMatchCondition > conditions)
Definition: klflib.cpp:802
void setPreviewSize(const QSize &sz)
Definition: klflib.h:96
void setTags(const QString &s)
Definition: klflib.h:102
QVariant mValue
Definition: klflib.h:182
virtual uint supportedFeatureFlags() const
List of features supported by this resource engine.
Definition: klflib.h:550
bool operator()(const KLFLibEntryWithId &a, const KLFLibEntryWithId &b)
Compares KLFLibResourceEngine::KLFLibEntryWithId's.
Definition: klflib.h:1628
virtual QStringList subResourceList() const
Definition: klflib.h:722
Tags about the equation (string)
Definition: klflib.h:67
virtual QString viewType() const
The (last) View Type used to display this resource.
Definition: klflib.h:613
fromValue(const T &value)
virtual QString title() const
The human-set title of this resource.
Definition: klflib.h:599
Provides a simple API for reading library resources.
Definition: klflib.h:1588
bool operator()(const KLFLibEntry &a, const KLFLibEntry &b)
Compares KLFLibEntry'ies.
Definition: klflib.h:1624
QImage preview() const
Definition: klflib.h:84
QList< EntryMatchCondition > mConditionList
Definition: klflib.h:244
entries have to match with all given conditions
Definition: klflib.h:221
A structure that will hold the result of a query() query.
Definition: klflib.h:970
static EntryMatchCondition mkNegateMatch(const EntryMatchCondition &condition)
Definition: klflib.cpp:788
An entry (single formula) in the library.
Definition: klflib.h:55
QList< int > wantedEntryProperties
Definition: klflib.h:951
An Image Preview of equation (scaled down QImage)
Definition: klflib.h:64
Matches a property ID with a string (with a StringMatch)
Definition: klflib.h:218
Helper class to encode an entry list as mime data (abstract interface)
Definition: klflib.h:1841
virtual QVariant property(const QString &propName) const
PropertyMatch(const PropertyMatch &other)
Definition: klflib.h:195
A KLFLibEntry in combination with a KLFLib::entryId.
Definition: klflib.h:447
PropertyMatch mPropertyMatch
Definition: klflib.h:243
void setPreview(const QImage &img)
Definition: klflib.h:95
Utility class for sorting library entry items.
Definition: klflib.h:276
Type type() const
Get which type of condition this is.
Definition: klflib.h:225
QDateTime dateTime() const
Definition: klflib.h:83
virtual QString suggestedViewTypeIdentifier() const
Definition: klflib.h:704
An abstract resource engine.
Definition: klflib.h:440
The Date/Time at which the equation was evaluated.
Definition: klflib.h:63
KLFLib::EntryMatchCondition matchCondition
Definition: klflib.h:946
StringMatch(const StringMatch &m)
Definition: klflib.h:166
QString tags() const
Definition: klflib.h:87
KLF_EXPORT QDataStream & operator>>(QDataStream &stream, KLFLibResourceEngine::KLFLibEntryWithId &entrywid)
Definition: klflib.cpp:821
bool isValid() const
Definition: klflib.h:291
virtual QStringList supportedTypes() const =0
PropertyMatch propertyMatch() const
Relevant for type PropertyMatchType.
Definition: klflib.h:227
QSize previewSize() const
Definition: klflib.h:85
KLFStyle style() const
Definition: klflib.h:88
QList< EntryMatchCondition > conditionList() const
Relevant for types OrMatchType and AndMatchType.
Definition: klflib.h:229
void setLatex(const QString &latex)
Definition: klflib.h:93

Generated by doxygen 1.8.8