forked from workattech/mock-machine-coding-3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.cpp
More file actions
48 lines (39 loc) · 1.05 KB
/
list.cpp
File metadata and controls
48 lines (39 loc) · 1.05 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 "list.h"
#include "board.h"
#include "card.h"
using namespace std;
List::List(string name, string id, Board* parentBoard){
this->name = name;
this->id = id;
this->parentBoard = parentBoard;
parentBoard->addList(this);
cout << "List created with name:" << name << " id:" << id << " parentBoard:" << parentBoard->getName() << endl;
}
void List::printList(){
cout << "LIST name:" << name << " id:" << id << endl;
cout << "*** CARDS ***" << endl;
for(set<Card*>::iterator it=cards.begin(); it!=cards.end(); it++)
(*it)->printCard();
}
void List::addCard(Card* card){
cards.insert(card);
}
void List::removeCard(Card* card){
if (cards.find(card)==cards.end())
cout << "Card " << card->getName() << " isn't a part of List " << name << endl;
else
cards.erase(card);
}
void List::deleteFromParentBoard(){
parentBoard->removeList(this);
}
set<Card*> List::getCards(){
return cards;
}
string List::getId(){
return id;
}
string List::getName(){
return name;
}