-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArtist.h
106 lines (92 loc) · 2.83 KB
/
Artist.h
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
97
98
99
100
101
102
103
104
105
106
/**
* @file Artist.h
* @brief The header for the Artist Class.
*/
#ifndef ARTIST_H
#define ARTIST_H
#include <crow.h>
#include <string>
/**
* @class Artist
* @brief A class that represents a touring Artist.
*
* Has basic functionality to get and set member variables.
*/
class Artist
{
private:
std::string name;
std::string type;
double cost;
public:
Artist() { }
/**
* @brief The constructor for direct parameters.
* @param initialName The string of the name.
* @param initialType The string of the description.
* @param initialCost The float of the cost.
* @exception invalid_argument If the name is blank.
* @exception invalid_argument If the description is blank.
* @exception invalid_argument If the cost is negative.
*/
Artist(std::string initialName, std::string initialType, double initialCost);
/**
* @brief The constructor for json.
* @param readValueJson The json form of the artist
* @exception invalid_argument If the name is blank.
* @exception invalid_argument If the description is blank.
* @exception invalid_argument If the cost is negative.
*/
Artist(crow::json::rvalue readValueJson);
/**
* @brief Shows the name of the artist.
* @return The string name.
*/
std::string getName();
/**
* @brief Changes the name of the Artist.
* @param newName The new name.
* @return The new name.
* @exception invalid_argument If the new name is blank.
*/
std::string setName(std::string newName);
/**
* @brief Shows the description of the artist.
* @return The string description.
*/
std::string getDescription();
/**
* @brief Changes the description of the artist.
* @param newType The new description.
* @return The new description.
* @exception invalid_argument If the new description is blank.
*/
std::string setDescription(std::string newType);
/**
* @brief Shows the cost of the artist.
* @return The cost.
*/
double getCost();
/**
* @brief Changes the cost of the artist.
* @param newCost The float cost.
* @return The new cost.
* @exception invalid_argument If the cost is negative.
*/
double setCost(double newCost);
/**
* @brief Coverts the Artist instance into json.
* @return The json form of the artist.
*/
crow::json::wvalue convertToJson();
/**
* @brief Updates an artist instance from given json.
* @param readValueJson The json to be read.
* @exception invalid_argument If the name is blank.
* @exception invalid_argument If the description is blank.
* @exception invalid_argument If the cost is negative.
*/
void updateFromJson(crow::json::rvalue readValueJson);
std::string getId() {return name;}
};
#endif