song/*SongFilter: use libfmt

This commit is contained in:
Max Kellermann 2023-11-25 20:39:05 +01:00
parent 273fc329e0
commit d0eea87b1a
3 changed files with 17 additions and 5 deletions

View File

@ -6,10 +6,14 @@
#include "time/ISO8601.hxx"
#include "util/StringBuffer.hxx"
#include <fmt/core.h>
using std::string_view_literals::operator""sv;
std::string
AddedSinceSongFilter::ToExpression() const noexcept
{
return std::string("(added-since \"") + FormatISO8601(value).c_str() + "\")";
return fmt::format("(added-since \"{}\")"sv, FormatISO8601(value).c_str());
}
bool

View File

@ -5,12 +5,16 @@
#include "LightSong.hxx"
#include "util/StringBuffer.hxx"
#include <fmt/core.h>
using std::string_view_literals::operator""sv;
std::string
AudioFormatSongFilter::ToExpression() const noexcept
{
return std::string("(AudioFormat ") +
(value.IsFullyDefined() ? "==" : "=~") +
" \"" + ToString(value).c_str() + "\")";
return fmt::format("(AudioFormat {} \"{}\")"sv,
value.IsFullyDefined() ? "==" : "=~",
ToString(value).c_str());
}
bool

View File

@ -6,10 +6,14 @@
#include "time/ISO8601.hxx"
#include "util/StringBuffer.hxx"
#include <fmt/core.h>
using std::string_view_literals::operator""sv;
std::string
ModifiedSinceSongFilter::ToExpression() const noexcept
{
return std::string("(modified-since \"") + FormatISO8601(value).c_str() + "\")";
return fmt::format("(modified-since \"{}\")"sv, FormatISO8601(value).c_str());
}
bool