summaryrefslogtreecommitdiff
path: root/src/dictionary/Field.h
blob: 08b012301000713d66fdf1525b34b3a3c7c337ed (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
41
42
43
44
45
46
#ifndef FIELD_H
#define FIELD_H

#include "../field-styles/FieldStyle.h"
#include "../field-styles/FieldStyleFactory.h"

#include <QString>

/**
 Field is a field of the dictionary entries. The fields are owned by the dictionary.
 Dictionary entries and card packs reuse the fields of the dictionary.

 Field id is its name. It's unique.

 When the field is renamed, its first original name is always saved in m_oldName.
 */

class Field
{
public:
    Field() {}
    Field( QString aName, QString aStyle = "" );

public:
    QString name() const {return m_name;}
    QString oldName() const {return m_oldName;}
    QString style() const {return m_style;}
    bool operator<( const Field& anotherField ) const { return m_name < anotherField.name(); }    
    bool operator==( const Field& anotherField ) const { return m_name == anotherField.name(); }
    QString id04() const { return m_id04; }

    void setName( const QString aName );
    void setStyle( QString aStyle ) { m_style = aStyle; }
    void setId04( const QString& aId ) { m_id04 = aId; }

private:
    QString m_name;
    QString m_style;
    QString m_oldName;  // For renaming

    // Obsolete:
    QString m_id04; ///< ID, compatible with v. 0.4

};

#endif