redmineitemtreedata.cpp 957 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "redmineitemtreedata.h"
  2. RedmineItemTreeData::RedmineItemTreeData()
  3. {
  4. }
  5. RedmineItemTreeData &RedmineItemTreeData::operator= ( const RedmineItemTreeData &from )
  6. {
  7. this->list = from.list;
  8. this->id2item = from.id2item;
  9. this->hierarchy = from.hierarchy;
  10. this->isToBeUpdated = from.isToBeUpdated;
  11. this->parent = from.parent;
  12. return *this;
  13. }
  14. void RedmineItemTreeData::clear()
  15. {
  16. this->list.clear();
  17. this->id2item.clear();
  18. this->hierarchy.clear();
  19. this->isToBeUpdated.clear();
  20. this->parent.clear();
  21. }
  22. void RedmineItemTreeData::add ( QJsonObject jsonObj )
  23. {
  24. this->list.append ( jsonObj );
  25. this->id2item.insert ( jsonObj["id"].toInt(), jsonObj );
  26. }
  27. QList<QJsonObject> RedmineItemTreeData::get()
  28. {
  29. return this->list;
  30. }
  31. QJsonObject RedmineItemTreeData::get ( int item_id )
  32. {
  33. return this->id2item[item_id];
  34. }
  35. QList<QJsonObject> RedmineItemTreeData::getchildren ( int item_id )
  36. {
  37. return this->hierarchy[item_id];
  38. }