adatabasetypes.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. *openPilotLog - A FOSS Pilot Logbook Application
  3. *Copyright (C) 2020-2022 Felix Turowsky
  4. *
  5. *This program is free software: you can redistribute it and/or modify
  6. *it under the terms of the GNU General Public License as published by
  7. *the Free Software Foundation, either version 3 of the License, or
  8. *(at your option) any later version.
  9. *
  10. *This program is distributed in the hope that it will be useful,
  11. *but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. *GNU General Public License for more details.
  14. *
  15. *You should have received a copy of the GNU General Public License
  16. *along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. #ifndef DECLARATIONS_H
  19. #define DECLARATIONS_H
  20. #include <QtCore>
  21. #include "src/functions/alog.h"
  22. /// \todo Short descriptions
  23. using RowId_T = int;
  24. using PilotName_T = QString;
  25. using PilotRowId_T = RowId_T;
  26. using TailRegistration_T = QString;
  27. using TailId_T = RowId_T;
  28. using AirportICAO_T = QString;
  29. using AirportIATA_T = QString;
  30. using AirportName_T = QString;
  31. using AirportId_T = RowId_T;
  32. using ColName_T = QString;
  33. using ColData_T = QVariant;
  34. using TableName_T = QString;
  35. using TableNames_T = QStringList;
  36. using RowData_T = QHash<ColName_T, ColData_T>;
  37. using ColumnData_T = QPair<ColName_T, ColData_T>;
  38. using ColumnNames_T = QStringList;
  39. using TableColumns_T = QHash<TableName_T, ColumnNames_T>;
  40. struct DataPosition {
  41. TableName_T tableName;
  42. RowId_T rowId;
  43. DataPosition()
  44. : tableName(TableName_T())
  45. {};
  46. DataPosition(TableName_T table_name, RowId_T row_id)
  47. : tableName(table_name), rowId(row_id)
  48. {};
  49. DataPosition(const DataPosition& other) = default;
  50. DataPosition& operator=(const DataPosition& other) = default;
  51. REPR(DataPosition,
  52. "tableName=" + object.tableName
  53. + ", rowId=" + QString::number(object.rowId)
  54. )
  55. };
  56. #endif // DECLARATIONS_H