MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

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
70 SongTime start_time;
71
76 SongTime end_time;
77
78 gcc_pure
79 std::string GetURI() const {
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;
91 };
92
93 #endif
Chrono.hxx
Tag
The meta information about a song file.
Definition: Tag.hxx:34
SongTime
A time stamp within a song.
Definition: Chrono.hxx:31
LightSong::GetDuration
gcc_pure SignedSongTime GetDuration() const
LightSong::GetURI
gcc_pure std::string GetURI() const
Definition: LightSong.hxx:79
LightSong::mtime
time_t mtime
Definition: LightSong.hxx:65
LightSong::uri
const char * uri
Definition: LightSong.hxx:48
LightSong::directory
const char * directory
If this is not nullptr, then it denotes a prefix for the uri.
Definition: LightSong.hxx:46
LightSong::start_time
SongTime start_time
Start of this sub-song within the file.
Definition: LightSong.hxx:70
Compiler.h
LightSong::real_uri
const char * real_uri
The "real" URI, the one to be used for opening the resource.
Definition: LightSong.hxx:58
LightSong::end_time
SongTime end_time
End of this sub-song within the file.
Definition: LightSong.hxx:76
LightSong::tag
const Tag * tag
Must not be nullptr.
Definition: LightSong.hxx:63
SignedSongTime
A variant of SongTime that is based on a signed integer.
Definition: Chrono.hxx:115
gcc_pure
#define gcc_pure
Definition: Compiler.h:116
LightSong
A reference to a song file.
Definition: LightSong.hxx:40