db/simple/Song: rename "uri" to "filename"
This attribute is not a URI; it is just the filename without its parent directory path. To avoid confusion, let's rename it to "filename", leaving the struct without a "uri" attribute.
This commit is contained in:
@@ -191,7 +191,7 @@ Directory::FindSong(const char *name_utf8) const noexcept
|
||||
for (auto &song : songs) {
|
||||
assert(&song.parent == this);
|
||||
|
||||
if (song.uri == name_utf8)
|
||||
if (song.filename == name_utf8)
|
||||
return &song;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ Song::Song(DetachedSong &&other, Directory &_parent) noexcept
|
||||
mtime(other.GetLastModified()),
|
||||
start_time(other.GetStartTime()),
|
||||
end_time(other.GetEndTime()),
|
||||
uri(other.GetURI())
|
||||
filename(other.GetURI())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -38,17 +38,17 @@ std::string
|
||||
Song::GetURI() const noexcept
|
||||
{
|
||||
if (parent.IsRoot())
|
||||
return uri;
|
||||
return filename;
|
||||
else {
|
||||
const char *path = parent.GetPath();
|
||||
return PathTraitsUTF8::Build(path, uri.c_str());
|
||||
return PathTraitsUTF8::Build(path, filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
LightSong
|
||||
Song::Export() const noexcept
|
||||
{
|
||||
LightSong dest(uri.c_str(), tag);
|
||||
LightSong dest(filename.c_str(), tag);
|
||||
if (!parent.IsRoot())
|
||||
dest.directory = parent.GetPath();
|
||||
dest.mtime = mtime;
|
||||
|
||||
@@ -91,11 +91,11 @@ struct Song {
|
||||
/**
|
||||
* The file name.
|
||||
*/
|
||||
std::string uri;
|
||||
std::string filename;
|
||||
|
||||
template<typename U>
|
||||
Song(U &&_uri, Directory &_parent) noexcept
|
||||
:parent(_parent), uri(std::forward<U>(_uri)) {}
|
||||
template<typename F>
|
||||
Song(F &&_filename, Directory &_parent) noexcept
|
||||
:parent(_parent), filename(std::forward<F>(_filename)) {}
|
||||
|
||||
Song(DetachedSong &&other, Directory &_parent) noexcept;
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ song_cmp(const Song &a, const Song &b) noexcept
|
||||
return ret < 0;
|
||||
|
||||
/* still no difference? compare file name */
|
||||
return IcuCollate(a.uri.c_str(), b.uri.c_str()) < 0;
|
||||
return IcuCollate(a.filename.c_str(), b.filename.c_str()) < 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user