summaryrefslogtreecommitdiff
path: root/src/dictionary/Field.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dictionary/Field.h')
-rw-r--r--src/dictionary/Field.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/dictionary/Field.h b/src/dictionary/Field.h
new file mode 100644
index 0000000..08b0123
--- /dev/null
+++ b/src/dictionary/Field.h
@@ -0,0 +1,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