Skip to content

Commit 880468c

Browse files
committed
song/{Tag,Uri}SongFilter: use libfmt in ToExpression()
1 parent 529830c commit 880468c

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/song/TagSongFilter.cxx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,20 @@
88
#include "tag/Tag.hxx"
99
#include "tag/Fallback.hxx"
1010

11+
#include <fmt/core.h>
12+
13+
using std::string_view_literals::operator""sv;
14+
1115
std::string
1216
TagSongFilter::ToExpression() const noexcept
1317
{
1418
const char *name = type == TAG_NUM_OF_ITEM_TYPES
1519
? "any"
1620
: tag_item_names[type];
1721

18-
return std::string("(") + name + " " + filter.GetOperator()
19-
+ " \"" + EscapeFilterString(filter.GetValue()) + "\")";
22+
return fmt::format("({} {} \"{}\")"sv,
23+
name, filter.GetOperator(),
24+
EscapeFilterString(filter.GetValue()));
2025
}
2126

2227
bool

src/song/UriSongFilter.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
#include "Escape.hxx"
66
#include "LightSong.hxx"
77

8+
#include <fmt/core.h>
9+
10+
using std::string_view_literals::operator""sv;
11+
812
std::string
913
UriSongFilter::ToExpression() const noexcept
1014
{
11-
return std::string("(file ") + filter.GetOperator()
12-
+ " \"" + EscapeFilterString(filter.GetValue()) + "\")";
15+
return fmt::format("(file {} \"{}\")"sv,
16+
filter.GetOperator(), EscapeFilterString(filter.GetValue()));
1317
}
1418

1519
bool

0 commit comments

Comments
 (0)