-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClassMusic.cpp
241 lines (193 loc) · 4.19 KB
/
ClassMusic.cpp
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
// --------------------------
// Kevin Doveton
// Copyright 2015
// --------------------------
#include "ClassMusic.h"
void SongData :: setID(int ID)
{
id = ID;
}
int SongData :: getID()
{
return id;
}
void SongData :: setArtist(std::string ARTIST)
{
artist = ARTIST;
}
std::string SongData :: getArtist()
{
return artist;
}
void SongData :: setAlbum(std::string ALBUM)
{
album = ALBUM;
}
std::string SongData :: getAlbum()
{
return album;
}
void SongData :: setTitle(std::string SONG)
{
song = SONG;
}
std::string SongData :: getTitle()
{
return song;
}
void SongData :: setPath(std::string PATH)
{
path = PATH;
}
std::string SongData :: getPath()
{
return path;
}
void SongData :: setRating(float RATING)
{
rating = RATING;
}
float SongData :: getRating()
{
if (rating == NULL)
return float(0);
else
return rating;
}
void SongData :: setPlayCount(int PLAYCOUNT)
{
playCount = PLAYCOUNT;
}
int SongData :: getPlayCount()
{
if (playCount == NULL)
return float(0);
else
return playCount;
}
void SongData :: setSkipCount(int SKIPCOUNT)
{
skipCount = SKIPCOUNT;
}
int SongData :: getSkipCount()
{
if (skipCount == NULL)
return float(0);
else
return skipCount;
}
void SongData :: setKind(std::string KIND)
{
kind = KIND;
}
std::string SongData :: getKind()
{
return kind;
}
void SongData :: setBitRate(int BITRATE)
{
bitRate = BITRATE;
}
int SongData :: getBitRate()
{
return bitRate;
}
void SongData :: setLastPlayed(std::string LASTPLAYED)
{
lastPlayed = LASTPLAYED;
}
std::string SongData :: getLastPlayed()
{
return lastPlayed;
}
void SongData :: setSampleRate(int SAMPLERATE)
{
sampleRate = SAMPLERATE;
}
int SongData :: getSampleRate()
{
return sampleRate;
}
void SongData :: setLength(int LENGTH)
{
length = LENGTH;
}
int SongData :: getLength()
{
return length;
}
std::string SongData :: getAlbumImagePath()
{
return albumImagePath;
}
void SongData :: get(int& ID, std::string& ARTIST, std::string& ALBUM, std::string& SONG, std::string& PATH, int& RATING, int& PLAYCOUNT, int& SKIPCOUNT, std::string& KIND, int& BITRATE, std::string& LASTPLAYED, int& SAMPLERATE, int& LENGTH)
{
// get the object
ID = id;
ARTIST = artist;
ALBUM = album;
SONG = song;
PATH = path;
RATING = rating;
PLAYCOUNT = playCount;
SKIPCOUNT = skipCount;
KIND = kind;
BITRATE = bitRate;
LASTPLAYED = lastPlayed;
SAMPLERATE = sampleRate;
LENGTH = length;
}
void SongData :: set(int ID, std::string ARTIST, std::string ALBUM, std::string SONG, std::string PATH, int RATING, int PLAYCOUNT, int SKIPCOUNT, std::string KIND, int BITRATE, std::string LASTPLAYED, int SAMPLERATE, int LENGTH, std::string ALBUMIMAGEPATH)
{
// set the object
id = ID;
artist = ARTIST;
album = ALBUM;
song = SONG;
path = PATH;
rating = RATING;
playCount = PLAYCOUNT;
skipCount = SKIPCOUNT;
kind = KIND;
bitRate = BITRATE;
lastPlayed = LASTPLAYED;
sampleRate = SAMPLERATE;
length = LENGTH;
albumImagePath = ALBUMIMAGEPATH;
}
std::string SongData :: dump(std::string info)
{
std::stringstream returnValue;
returnValue.str("");
if (info == "all")
returnValue << "id: " << (id) << ", artist: " << artist << ", album: " << album << ", song: " << song << ", path: " << path << ", rating: " << rating << ", playCount: " << playCount << ", skipCount: " << skipCount << ", kind: " << kind << ", bitRate: " << bitRate << ", lastPlayed: " << lastPlayed << ", sampleRate: " << sampleRate << ", length: " << length;
else if(info == "id")
returnValue << id;
else if (info == "artist")
returnValue << artist;
else if (info == "album")
returnValue << album;
else if (info == "song")
returnValue << song;
else if (info == "path")
returnValue << path;
else if (info == "rating")
returnValue << rating;
else if ((info == "playCount") || (info == "playcount"))
returnValue << playCount;
else if ((info == "skipCount") || (info == "skipcount"))
returnValue << skipCount;
else if (info == "kind")
returnValue << kind;
else if (info == "bitrate")
returnValue << bitRate;
else if (info == "lastplayed")
returnValue << lastPlayed;
else if (info == "samplerate")
returnValue << sampleRate;
else if (info == "length")
returnValue << length;
else
returnValue.str("failed");
return returnValue.str();
}