diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2021-07-14 11:49:10 +1200 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2021-07-14 11:49:10 +1200 |
commit | d24f813f3f2a05c112e803e4256b53535895fc98 (patch) | |
tree | 601e6ae9a1cd44bcfdcf91739a5ca36aedd827c9 /src/dictionary/IDictionary.h |
Diffstat (limited to 'src/dictionary/IDictionary.h')
-rw-r--r-- | src/dictionary/IDictionary.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/dictionary/IDictionary.h b/src/dictionary/IDictionary.h new file mode 100644 index 0000000..bfc82bc --- /dev/null +++ b/src/dictionary/IDictionary.h @@ -0,0 +1,51 @@ +#ifndef IDICTIONARY_H +#define IDICTIONARY_H + +#include <QtCore> + +class DicRecord; +class Field; +class CardPack; + +class IDictionary +{ +public: + static const int AllFields = -1; + +public: + IDictionary(const QString& filePath = ""): + filePath(filePath) {} + virtual ~IDictionary(); + + void addRecord(DicRecord* record); + void addRecords(const QList<DicRecord*>& records); + QList<DicRecord*> getRecords() const { return records; } + + virtual const Field* field( int aIx ) const = 0; + virtual const Field* field( const QString aFieldName ) const = 0; + virtual int indexOfCardPack( CardPack* aPack ) const = 0; + + virtual void addCardPack(CardPack* aCardPack) = 0; + + virtual QFile::FileError saveStudy() { return QFile::NoError; } + + // Stats + int countTodaysAllCards() const; + int countTodaysNewCards() const; + + QString extendImagePaths(QString text) const; + QString getImagesPath() const; + +protected: + virtual void notifyRecordsInserted(int /*index*/, int /*num*/) {} + +private: + static QString replaceImagePaths(QString text, const QString& shortDir, + const QString& replacingPath); + +protected: + QString filePath; + QList<DicRecord*> records; + QList<CardPack*> m_cardPacks; +}; +#endif |