diffmodel.cpp 708 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "diffmodel.h"
  2. DiffModel::DiffModel(const QString &path, QObject *parent) : QObject(parent)
  3. ,m_path(path)
  4. ,m_type(Unmodified)
  5. {
  6. }
  7. DiffModel::~DiffModel()
  8. {
  9. }
  10. DiffModel::DiffModel(const DiffModel& other) : QObject()
  11. {
  12. m_type = other.m_type;
  13. m_path = other.m_path;
  14. m_data = other.m_data;
  15. }
  16. DiffModel& DiffModel::operator=(const DiffModel& other)
  17. {
  18. if(this != &other) {
  19. m_type = other.m_type;
  20. emit typeChanged(m_type);
  21. m_path = other.m_path;
  22. m_data = other.m_data;
  23. emit dataChanged(m_data);
  24. }
  25. return *this;
  26. }
  27. void DiffModel::append(const QString& unifiedData)
  28. {
  29. m_data.append(unifiedData);
  30. emit dataChanged(m_data);
  31. }