MPD  0.20.15
LightSong.hxx
Go to the documentation of this file.
1 /*
2  * Copyright 2003-2017 The Music Player Daemon Project
3  * http://www.musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef MPD_LIGHT_SONG_HXX
21 #define MPD_LIGHT_SONG_HXX
22 
23 #include "Chrono.hxx"
24 #include "Compiler.h"
25 
26 #include <string>
27 
28 #include <time.h>
29 
30 struct Tag;
31 
40 struct LightSong {
46  const char *directory;
47 
48  const char *uri;
49 
58  const char *real_uri;
59 
63  const Tag *tag;
64 
65  time_t mtime;
66 
71 
77 
78  gcc_pure
79  std::string GetURI() const noexcept {
80  if (directory == nullptr)
81  return std::string(uri);
82 
83  std::string result(directory);
84  result.push_back('/');
85  result.append(uri);
86  return result;
87  }
88 
89  gcc_pure
90  SignedSongTime GetDuration() const noexcept;
91 };
92 
93 #endif
The meta information about a song file.
Definition: Tag.hxx:34
A time stamp within a song.
Definition: Chrono.hxx:31
gcc_pure std::string GetURI() const noexcept
Definition: LightSong.hxx:79
time_t mtime
Definition: LightSong.hxx:65
const char * uri
Definition: LightSong.hxx:48
const char * directory
If this is not nullptr, then it denotes a prefix for the uri.
Definition: LightSong.hxx:46
SongTime start_time
Start of this sub-song within the file.
Definition: LightSong.hxx:70
const char * real_uri
The "real" URI, the one to be used for opening the resource.
Definition: LightSong.hxx:58
SongTime end_time
End of this sub-song within the file.
Definition: LightSong.hxx:76
const Tag * tag
Must not be nullptr.
Definition: LightSong.hxx:63
A variant of SongTime that is based on a signed integer.
Definition: Chrono.hxx:115
gcc_pure SignedSongTime GetDuration() const noexcept
#define gcc_pure
Definition: Compiler.h:116
A reference to a song file.
Definition: LightSong.hxx:40