enumerations.h 883 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef ENUMERATIONS_H
  2. #define ENUMERATIONS_H
  3. #include <QObject>
  4. #include <QHash>
  5. #include <QJsonObject>
  6. #include <QJsonArray>
  7. class Enumerations
  8. {
  9. public:
  10. Enumerations();
  11. enum item_type {
  12. EIT_UNKNOWN = 0,
  13. EIT_ISSUE,
  14. EIT_TIME_ENTRY,
  15. EIT_DOCUMENT,
  16. };
  17. struct enumeration {
  18. int id;
  19. int position;
  20. QString name;
  21. enum item_type item_type;
  22. QString field_name;
  23. };
  24. struct enumeration get ( int enumeration_id );
  25. QHash<QString, QList<struct enumeration>> get ( enum item_type item_type );
  26. void set ( QJsonArray json_array );
  27. private:
  28. QHash <int, struct enumeration> id2enumeration;
  29. QHash <enum item_type, QHash<QString, QList<struct enumeration>>> itemType2enumeration;
  30. //QHash <QString, struct enumeration> name2enumeration;
  31. void add ( QJsonObject json_enumeration );
  32. void clear();
  33. };
  34. #endif // ENUMERATIONS_H