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/Field.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/dictionary/Field.h (limited to 'src/dictionary/Field.h') 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 + +/** + 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 -- cgit