2
0

acurrencyentry.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef ACURRENCYENTRY_H
  2. #define ACURRENCYENTRY_H
  3. #include "src/database/databasetypes.h"
  4. /*!
  5. * \brief The Entry class encapsulates table metadata(table name, row id)
  6. * and data for new and existing entries in the database to operate on.
  7. */
  8. class AEntry {
  9. protected:
  10. DataPosition position;
  11. public:
  12. RowData_T tableData;
  13. public:
  14. AEntry() = delete;
  15. AEntry(const AEntry&) = default;
  16. AEntry& operator=(const AEntry&) = default;
  17. AEntry(DataPosition position_);
  18. AEntry(RowData_T table_data);
  19. AEntry(DataPosition position_, RowData_T table_data);
  20. void setData(RowData_T table_data);
  21. void setPosition(DataPosition position_);
  22. const DataPosition& getPosition() const;
  23. const TableName_T &getTableName() const { return position.tableName; }
  24. const RowId_T &getRowId() const { return position.rowId; }
  25. const RowData_T& getData() const;
  26. /*!
  27. * \brief operator QString provides compatibilty with QDebug() - prints
  28. * the tableData in a readable formatting to stdout
  29. */
  30. operator QString() const;
  31. };
  32. struct ACurrencyEntry : public AEntry
  33. {
  34. public:
  35. enum class CurrencyName {
  36. Licence = 1,
  37. TypeRating = 2,
  38. LineCheck = 3,
  39. Medical = 4,
  40. Custom1 = 5,
  41. Custom2 = 6
  42. };
  43. ACurrencyEntry() = delete;
  44. ACurrencyEntry(CurrencyName name);
  45. ACurrencyEntry(CurrencyName name, QDate expiration_date);
  46. ACurrencyEntry(const ACurrencyEntry& te) = default;
  47. ACurrencyEntry& operator=(const ACurrencyEntry& te) = default;
  48. bool isValid() const;
  49. };
  50. #endif // ACURRENCYENTRY_H