Advertisement
Guest User

tagtuple.cpp

a guest
Aug 11th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "tagtuple.h"
  2.  
  3. TagTuple::TagTuple()
  4. {
  5.     id = new int;
  6.     name = new QString;
  7. }
  8.  
  9. TagTuple::TagTuple(const int& id, const QString& name)
  10. {
  11.     this->id = new int(id);
  12.     this->name = new QString(name);
  13. }
  14.  
  15. TagTuple::TagTuple(const TagTuple& tagTuple)
  16. {
  17.     this->id = new int(tagTuple.getId());
  18.     this->name = new QString(tagTuple.getName());
  19. }
  20.  
  21. TagTuple::~TagTuple()
  22. {
  23.     if (id != nullptr) delete id;
  24.     if (name != nullptr) delete name;
  25. }
  26.  
  27. void TagTuple::setId(const int& id)
  28. {
  29.     *(this->id) = id;
  30. }
  31.  
  32. void TagTuple::setName(const QString& name)
  33. {
  34.     *(this->name) = name;
  35. }
  36.  
  37. int TagTuple::getId() const
  38. {
  39.     return *id;
  40. }
  41.  
  42. QString TagTuple::getName() const
  43. {
  44.     return *name;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement