-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshirt.cc
96 lines (84 loc) · 2.51 KB
/
shirt.cc
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include "shirt.h"
/**
* @class Shirt
* @file shirt.cc
* @author Stephen M. Reaves
* @date July 14th, 2018
*/
using namespace std;
/**
* Default Constructor
*/
Shirt::Shirt() {}
/**
* Parameterized Constructor
*
* @param id Integer to identify this shirt uniquely across the closet
* @param name String to identify this shirt to the user
* @param prim_color Primary color
* @param sec_color Secondary color
* @param tert_color Tertiary color
* @param pattern Design pattern
* @param sleeve_length Length of the sleeve
* @param collar Type of collar
*
* @returns Shirt object
*/
Shirt::Shirt(int id, string name, string prim_color, string sec_color,
string tert_color, string pattern, string sleeve_length,
string collar) {
this->id_ = id;
this->name_ = name;
this->primary_color_ = prim_color;
this->secondary_color_ = sec_color;
this->tertiary_color_ = tert_color;
this->pattern_ = pattern;
this->sleeve_length_ = sleeve_length;
this->collar_ = collar;
}
/**
* Deconstructor
*/
Shirt::~Shirt() {}
/******************************************************************************
* Accessors and Mutators
*/
/******************************************************************************
* General Functions
*/
/**
* ToXML
* @deprecated
* @returns XML representing the shirt.
*/
string Shirt::ToXML() const {
string s = "";
s += " <Shirt ID=" + to_string(this->id_) + ">\n";
s += " <Name>" + this->name_ + "</Name>\n";
s += " <Primary Color>" + this->primary_color_ + "</Primary Color>\n";
s +=
" <Secondary Color>" + this->secondary_color_ + "</Secondary Color>\n";
s += " <Tertiary Color>" + this->tertiary_color_ + "</Tertiary Color>\n";
s += " <Pattern>" + this->pattern_ + "</Pattern>\n";
s += " <Sleeve Length>" + this->sleeve_length_ + "</Sleeve Length>\n";
s += " <Collar>" + this->collar_ + "</Collar>\n";
s += " </Shirt>\n";
return s;
}
/**
* ToString
* @returns 'string' representing the shirt.
*/
string Shirt::ToString() const {
string s = "\n";
s += "Name: " + this->name_ + "\n";
s += "ID: " + to_string(this->id_);
s += "\n";
s += " -> Primary Color: " + this->primary_color_ + "\n";
s += " -> Secondary Color: " + this->secondary_color_ + "\n";
s += " -> Tertiary Color: " + this->tertiary_color_ + "\n";
s += " -> Pattern: " + this->pattern_ + "\n";
s += " -> Sleeve Length: " + this->sleeve_length_ + "\n";
s += " -> Collar: " + this->collar_ + "\n";
return s;
}