summaryrefslogtreecommitdiff
path: root/src/dictionary/DicRecord.h
blob: 913da08d45a0319c4af6203186669dde7e864189 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef DICENTRY_H
#define DICENTRY_H

#include <QtCore>

class Field;
class ICardPack;

class DicRecord: public QObject
{
Q_OBJECT

public:
    DicRecord();
    DicRecord( const DicRecord& aOther );

    const QHash<QString, QString> getFields() const {return fields;}
    QString getFieldValue(const QString& name) const { return fields.value(name); }
    QStringList getFieldElements(const QString& fieldName) const;
    QString getPreviewQuestionForPack(ICardPack* pack) const;
    QString id04() const { return m_id04; }
    void setField( QString aField, QString aValue );
    void setId04( const QString& aId ) { m_id04 = aId; }
    void renameField( const QString aOldFieldName, const QString aNewFieldName );
    bool isValid(const QString& qstFieldName)  const;

private:
    bool hasNonEmptyAnswerField(const QString& qstFieldName) const;

signals:
    void valueChanged( QString aField );

private:
    QHash<QString, QString> fields; // Field name -> field value
    QString m_id04; // For v. 0.4
};

Q_DECLARE_METATYPE( DicRecord )

#endif