db/simple/Song: reorder fields for better packing

This commit is contained in:
Max Kellermann 2021-10-14 12:52:52 +02:00
parent e4eb5b79c9
commit b82b56970b
2 changed files with 20 additions and 20 deletions

View File

@ -29,13 +29,13 @@
#include "util/IterableSplitString.hxx" #include "util/IterableSplitString.hxx"
Song::Song(DetachedSong &&other, Directory &_parent) noexcept Song::Song(DetachedSong &&other, Directory &_parent) noexcept
:tag(std::move(other.WritableTag())), :parent(_parent),
parent(_parent), filename(other.GetURI()),
tag(std::move(other.WritableTag())),
mtime(other.GetLastModified()), mtime(other.GetLastModified()),
start_time(other.GetStartTime()), start_time(other.GetStartTime()),
end_time(other.GetEndTime()), end_time(other.GetEndTime()),
audio_format(other.GetAudioFormat()), audio_format(other.GetAudioFormat())
filename(other.GetURI())
{ {
} }

View File

@ -56,13 +56,27 @@ struct Song {
*/ */
Hook siblings; Hook siblings;
Tag tag;
/** /**
* The #Directory that contains this song. * The #Directory that contains this song.
*/ */
Directory &parent; Directory &parent;
/**
* The file name.
*/
std::string filename;
/**
* If non-empty, then this object does not describe a file
* within the `music_directory`, but some sort of symbolic
* link pointing to this value. It can be an absolute URI
* (i.e. with URI scheme) or a URI relative to this object
* (which may begin with one or more "../").
*/
std::string target;
Tag tag;
/** /**
* The time stamp of the last file modification. A negative * The time stamp of the last file modification. A negative
* value means that this is unknown/unavailable. * value means that this is unknown/unavailable.
@ -87,20 +101,6 @@ struct Song {
*/ */
AudioFormat audio_format = AudioFormat::Undefined(); AudioFormat audio_format = AudioFormat::Undefined();
/**
* The file name.
*/
std::string filename;
/**
* If non-empty, then this object does not describe a file
* within the `music_directory`, but some sort of symbolic
* link pointing to this value. It can be an absolute URI
* (i.e. with URI scheme) or a URI relative to this object
* (which may begin with one or more "../").
*/
std::string target;
template<typename F> template<typename F>
Song(F &&_filename, Directory &_parent) noexcept Song(F &&_filename, Directory &_parent) noexcept
:parent(_parent), filename(std::forward<F>(_filename)) {} :parent(_parent), filename(std::forward<F>(_filename)) {}