From d24f813f3f2a05c112e803e4256b53535895fc98 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 14 Jul 2021 11:49:10 +1200 Subject: Initial mirror commit --- src/dictionary/IDictionary.h | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/dictionary/IDictionary.h (limited to 'src/dictionary/IDictionary.h') 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 + +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& records); + QList 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 records; + QList m_cardPacks; +}; +#endif -- cgit