33
34
* all variables in the constructor. This is cumbersome so this class
34
35
* allows you to gather them one by one and then finally construct
35
36
* a fully valid MediaFile.
37
* If you try to assign the same property twice, an exception is thrown.
38
* This means that MediaFileBuilders are meant to build only one
39
* MediaFile. To build a new one create a new MediaFileBuilder. This is to
40
* ensure that no state leaks from the first MediaFile to the second.
43
39
class MediaFileBuilder final {
40
friend class MediaFile;
45
42
MediaFileBuilder(const std::string &filename);
46
43
MediaFileBuilder(const MediaFile &mf);
47
44
MediaFileBuilder(const MediaFileBuilder &) = delete;
48
45
MediaFileBuilder& operator=(MediaFileBuilder &) = delete;
50
48
MediaFile build() const;
52
void setType(MediaType t);
53
void setETag(const std::string &e);
54
void setContentType(const std::string &c);
55
void setTitle(const std::string &t);
56
void setDate(const std::string &d);
57
void setAuthor(const std::string &a);
58
void setAlbum(const std::string &a);
59
void setAlbumArtist(const std::string &a);
60
void setGenre(const std::string &g);
61
void setDiscNumber(int n);
62
void setTrackNumber(int n);
63
void setDuration(int d);
50
MediaFileBuilder &setType(MediaType t);
51
MediaFileBuilder &setETag(const std::string &e);
52
MediaFileBuilder &setContentType(const std::string &c);
53
MediaFileBuilder &setTitle(const std::string &t);
54
MediaFileBuilder &setDate(const std::string &d);
55
MediaFileBuilder &setAuthor(const std::string &a);
56
MediaFileBuilder &setAlbum(const std::string &a);
57
MediaFileBuilder &setAlbumArtist(const std::string &a);
58
MediaFileBuilder &setGenre(const std::string &g);
59
MediaFileBuilder &setDiscNumber(int n);
60
MediaFileBuilder &setTrackNumber(int n);
61
MediaFileBuilder &setDuration(int d);
66
bool type_set = false;
67
MediaType type = UnknownMedia;
71
bool content_type_set = false;
72
std::string content_type;
74
bool etag_set = false;
77
bool title_set = false;
80
bool date_set = false;
83
bool author_set = false;
86
bool album_set = false;
89
bool album_artist_set = false;
90
std::string album_artist;
92
bool genre_set = false;
95
bool disc_number_set = false;
98
bool track_number_set = false;
101
bool duration_set = false;