2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2014-07-11 20:01:53 +02:00
|
|
|
|
|
|
|
#ifndef MPD_BULK_EDIT_HXX
|
|
|
|
#define MPD_BULK_EDIT_HXX
|
|
|
|
|
|
|
|
#include "Partition.hxx"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Begin a "bulk edit" and commit it automatically.
|
|
|
|
*/
|
|
|
|
class ScopeBulkEdit {
|
|
|
|
Partition &partition;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ScopeBulkEdit(Partition &_partition):partition(_partition) {
|
|
|
|
partition.playlist.BeginBulk();
|
|
|
|
}
|
|
|
|
|
|
|
|
~ScopeBulkEdit() {
|
|
|
|
partition.playlist.CommitBulk(partition.pc);
|
|
|
|
}
|
2023-11-26 08:47:04 +01:00
|
|
|
|
|
|
|
ScopeBulkEdit(const ScopeBulkEdit &) = delete;
|
|
|
|
ScopeBulkEdit &operator=(const ScopeBulkEdit &) = delete;
|
2014-07-11 20:01:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|