command/playlist: allow range in playlistdelete

This commit is contained in:
Max Kellermann
2021-10-25 12:16:20 +02:00
parent ade847bc89
commit 48e8a26813
5 changed files with 19 additions and 3 deletions

View File

@@ -26,6 +26,7 @@
#include "song/DetachedSong.hxx"
#include "SongLoader.hxx"
#include "Mapper.hxx"
#include "protocol/RangeArg.hxx"
#include "fs/io/TextFile.hxx"
#include "fs/io/FileOutputStream.hxx"
#include "fs/io/BufferedOutputStream.hxx"
@@ -314,6 +315,16 @@ PlaylistFileEditor::RemoveIndex(unsigned i)
contents.erase(std::next(contents.begin(), i));
}
void
PlaylistFileEditor::RemoveRange(RangeArg range)
{
if (!range.CheckClip(size()))
throw PlaylistError::BadRange();
contents.erase(std::next(contents.begin(), range.start),
std::next(contents.begin(), range.end));
}
void
PlaylistFileEditor::Save()
{