File indexing completed on 2024-05-19 05:41:19

0001 #ifndef UNIT_H
0002 #define UNIT_H
0003 #include "rwidgets_global.h"
0004 #include <QMetaType>
0005 #include <QString>
0006 namespace GMTOOL
0007 {
0008 class RWIDGET_EXPORT Unit
0009 {
0010 public:
0011     enum Category
0012     {
0013         TEMPERATURE,
0014         DISTANCE,
0015         CURRENCY,
0016         VOLUME,
0017         MASS,
0018         CUSTOM
0019     };
0020     Unit();
0021     Unit(QString name, QString symbol, Category c);
0022     Unit(const Unit& copy);
0023     ~Unit();
0024     // Unit(const Unit&& copy);
0025     Unit& operator=(const Unit&);
0026     QString symbol() const;
0027     void setSymbol(const QString& symbol);
0028 
0029     QString name() const;
0030     void setName(const QString& name);
0031 
0032     Unit::Category currentCat() const;
0033     void setCurrentCat(const Unit::Category& currentCat);
0034 
0035     bool readOnly() const;
0036     void setReadOnly(bool readOnly);
0037 
0038 private:
0039     QString m_name;
0040     QString m_symbol;
0041     Unit::Category m_currentCat;
0042     bool m_readOnly= true;
0043 };
0044 } // namespace GMTOOL
0045 Q_DECLARE_METATYPE(GMTOOL::Unit)
0046 Q_DECLARE_METATYPE(GMTOOL::Unit*)
0047 #endif // UNIT_H