db/*: use std::span instead of ConstBuffer
This commit is contained in:
@@ -37,7 +37,6 @@
|
||||
#include "tag/Builder.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "tag/ParseName.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/RecursiveMap.hxx"
|
||||
#include "util/ScopeExit.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
@@ -136,7 +135,7 @@ public:
|
||||
VisitPlaylist visit_playlist) const override;
|
||||
|
||||
RecursiveMap<std::string> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
ConstBuffer<TagType> tag_types) const override;
|
||||
std::span<const TagType> tag_types) const override;
|
||||
|
||||
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
||||
|
||||
@@ -440,13 +439,13 @@ SendGroup(mpd_connection *connection, TagType group)
|
||||
}
|
||||
|
||||
static bool
|
||||
SendGroup(mpd_connection *connection, ConstBuffer<TagType> group)
|
||||
SendGroup(mpd_connection *connection, std::span<const TagType> group)
|
||||
{
|
||||
while (!group.empty()) {
|
||||
if (!SendGroup(connection, group.back()))
|
||||
return false;
|
||||
|
||||
group.pop_back();
|
||||
group = group.first(group.size() - 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1010,7 +1009,7 @@ ProxyDatabase::Visit(const DatabaseSelection &selection,
|
||||
|
||||
RecursiveMap<std::string>
|
||||
ProxyDatabase::CollectUniqueTags(const DatabaseSelection &selection,
|
||||
ConstBuffer<TagType> tag_types) const
|
||||
std::span<const TagType> tag_types) const
|
||||
try {
|
||||
// TODO: eliminate the const_cast
|
||||
const_cast<ProxyDatabase *>(this)->EnsureConnected();
|
||||
@@ -1019,8 +1018,7 @@ try {
|
||||
if (tag_type2 == MPD_TAG_COUNT)
|
||||
throw std::runtime_error("Unsupported tag");
|
||||
|
||||
auto group = tag_types;
|
||||
group.pop_back();
|
||||
const auto group = tag_types.first(tag_types.size() - 1);
|
||||
|
||||
if (!mpd_search_db_tags(connection, tag_type2) ||
|
||||
!SendConstraints(connection, selection, selection.window) ||
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#include "fs/FileSystem.hxx"
|
||||
#include "util/CharUtil.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/RecursiveMap.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
@@ -334,7 +333,7 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
|
||||
|
||||
RecursiveMap<std::string>
|
||||
SimpleDatabase::CollectUniqueTags(const DatabaseSelection &selection,
|
||||
ConstBuffer<TagType> tag_types) const
|
||||
std::span<const TagType> tag_types) const
|
||||
{
|
||||
return ::CollectUniqueTags(*this, selection, tag_types);
|
||||
}
|
||||
|
@@ -126,7 +126,7 @@ public:
|
||||
VisitPlaylist visit_playlist) const override;
|
||||
|
||||
RecursiveMap<std::string> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
ConstBuffer<TagType> tag_types) const override;
|
||||
std::span<const TagType> tag_types) const override;
|
||||
|
||||
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
||||
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include "db/Stats.hxx"
|
||||
#include "tag/Table.hxx"
|
||||
#include "fs/Traits.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/RecursiveMap.hxx"
|
||||
#include "util/SplitString.hxx"
|
||||
#include "config/Block.hxx"
|
||||
@@ -101,7 +100,7 @@ public:
|
||||
VisitPlaylist visit_playlist) const override;
|
||||
|
||||
[[nodiscard]] RecursiveMap<std::string> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
ConstBuffer<TagType> tag_types) const override;
|
||||
std::span<const TagType> tag_types) const override;
|
||||
|
||||
[[nodiscard]] DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
||||
|
||||
@@ -629,7 +628,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
|
||||
|
||||
RecursiveMap<std::string>
|
||||
UpnpDatabase::CollectUniqueTags(const DatabaseSelection &selection,
|
||||
ConstBuffer<TagType> tag_types) const
|
||||
std::span<const TagType> tag_types) const
|
||||
{
|
||||
return ::CollectUniqueTags(*this, selection, tag_types);
|
||||
}
|
||||
|
Reference in New Issue
Block a user