forked from hrkfdn/mpdas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
song.hpp
37 lines (29 loc) · 831 Bytes
/
song.hpp
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
#ifndef SONG_HPP
#define SONG_HPP
#include <map>
#include <string>
#include <mpd/client.h>
class Song {
public:
Song() {};
Song(struct mpd_song *song);
const std::map<std::string, std::string>& tags() const {
return _tags;
}
int duration() const;
// Do not create tag if it does not exist
std::string operator[] (std::string tagName) const {
if(_tags.count(tagName))
return _tags.at(tagName);
else
return std::string();
}
std::string& operator[] (std::string tagName) {
return _tags[tagName];
}
private:
std::map<std::string, std::string> _tags;
void setTag(std::string name, const char* value);
void setDuration(int d);
};
#endif