db/simple/Song: move struct Disposer to separate header
Allow forward-declaring it.
This commit is contained in:
parent
0c48b8d084
commit
02bb47dd08
@ -20,6 +20,7 @@
|
||||
#include "Directory.hxx"
|
||||
#include "SongSort.hxx"
|
||||
#include "Song.hxx"
|
||||
#include "Disposer.hxx"
|
||||
#include "Mount.hxx"
|
||||
#include "db/LightDirectory.hxx"
|
||||
#include "song/LightSong.hxx"
|
||||
@ -50,7 +51,7 @@ Directory::~Directory() noexcept
|
||||
mounted_database.reset();
|
||||
}
|
||||
|
||||
songs.clear_and_dispose(Song::Disposer());
|
||||
songs.clear_and_dispose(SongDisposer());
|
||||
children.clear_and_dispose(DeleteDisposer());
|
||||
}
|
||||
|
||||
|
29
src/db/plugins/simple/Disposer.hxx
Normal file
29
src/db/plugins/simple/Disposer.hxx
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2003-2019 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef MPD_SONG_DISPOSER_HXX
|
||||
#define MPD_SONG_DISPOSER_HXX
|
||||
|
||||
struct Song;
|
||||
|
||||
struct SongDisposer {
|
||||
void operator()(Song *song) const noexcept;
|
||||
};
|
||||
|
||||
#endif
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "Song.hxx"
|
||||
#include "Disposer.hxx"
|
||||
#include "Directory.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "util/VarSize.hxx"
|
||||
@ -76,6 +77,12 @@ Song::Free() noexcept
|
||||
DeleteVarSize(this);
|
||||
}
|
||||
|
||||
void
|
||||
SongDisposer::operator()(Song *song) const noexcept
|
||||
{
|
||||
song->Free();
|
||||
}
|
||||
|
||||
std::string
|
||||
Song::GetURI() const noexcept
|
||||
{
|
||||
|
@ -45,12 +45,6 @@ struct Song {
|
||||
typedef boost::intrusive::link_mode<link_mode> LinkMode;
|
||||
typedef boost::intrusive::list_member_hook<LinkMode> Hook;
|
||||
|
||||
struct Disposer {
|
||||
void operator()(Song *song) const noexcept {
|
||||
song->Free();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Pointers to the siblings of this directory within the
|
||||
* parent directory. It is unused (undefined) if this song is
|
||||
|
Loading…
Reference in New Issue
Block a user