forked from workattech/mock-machine-coding-3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcard.cpp
More file actions
48 lines (39 loc) · 1.08 KB
/
card.cpp
File metadata and controls
48 lines (39 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <bits/stdc++.h>
#include "card.h"
#include "list.h"
#include "user.h"
using namespace std;
Card::Card(string name, string id, List* parentList){
this->name = name;
this->id = id;
assignedTo = nullptr;
this->parentList = parentList;
parentList->addCard(this);
cout << "Card created with name:" << name << " id:" << id << " parentList:" << parentList->getName() << endl;
}
void Card::printCard(){
cout << "CARD name:" << name << " id:" << id << " assignedTo:" << ((assignedTo==nullptr)?"None":assignedTo->getName()) << " description:" << description << endl;
}
void Card::assignTo(User* user){
//apply check whether user is a part of this board or not.
assignedTo = user;
user->addCard(this);
}
void Card::deleteThisCard(){
parentList->removeCard(this);
if(assignedTo){
assignedTo->unassignCard(this);
}
}
string Card::getId(){
return id;
}
string Card::getName(){
return name;
}
void Card::setName(string newName){
name = newName;
}
void Card::setDescription(string newDescription){
description = newDescription;
}