Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
78a65cf2
Commit
78a65cf2
authored
Jul 25, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SongFilter: remove DetachedSong overloads
All DetachedSong instances should be converted to LightSong first, which is a very cheap operation.
parent
96017f58
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
37 deletions
+6
-37
SongFilter.cxx
src/SongFilter.cxx
+1
-26
SongFilter.hxx
src/SongFilter.hxx
+2
-10
QueuePrint.cxx
src/queue/QueuePrint.cxx
+3
-1
No files found.
src/SongFilter.cxx
View file @
78a65cf2
...
...
@@ -20,8 +20,8 @@
#include "config.h"
#include "SongFilter.hxx"
#include "db/LightSong.hxx"
#include "DetachedSong.hxx"
#include "tag/ParseName.hxx"
#include "tag/Tag.hxx"
#include "util/CharUtil.hxx"
#include "util/ChronoUtil.hxx"
#include "util/ConstBuffer.hxx"
...
...
@@ -158,21 +158,6 @@ SongFilter::Item::MatchNN(const Tag &_tag) const noexcept
}
bool
SongFilter
::
Item
::
MatchNN
(
const
DetachedSong
&
song
)
const
noexcept
{
if
(
tag
==
LOCATE_TAG_BASE_TYPE
)
return
uri_is_child_or_same
(
value
.
c_str
(),
song
.
GetURI
());
if
(
tag
==
LOCATE_TAG_MODIFIED_SINCE
)
return
song
.
GetLastModified
()
>=
time
;
if
(
tag
==
LOCATE_TAG_FILE_TYPE
)
return
StringMatchNN
(
song
.
GetURI
());
return
MatchNN
(
song
.
GetTag
());
}
bool
SongFilter
::
Item
::
MatchNN
(
const
LightSong
&
song
)
const
noexcept
{
if
(
tag
==
LOCATE_TAG_BASE_TYPE
)
{
...
...
@@ -381,16 +366,6 @@ SongFilter::Parse(ConstBuffer<const char *> args, bool fold_case)
}
bool
SongFilter
::
Match
(
const
DetachedSong
&
song
)
const
noexcept
{
for
(
const
auto
&
i
:
items
)
if
(
!
i
.
Match
(
song
))
return
false
;
return
true
;
}
bool
SongFilter
::
Match
(
const
LightSong
&
song
)
const
noexcept
{
for
(
const
auto
&
i
:
items
)
...
...
src/SongFilter.hxx
View file @
78a65cf2
...
...
@@ -45,7 +45,6 @@ template<typename T> struct ConstBuffer;
struct
Tag
;
struct
TagItem
;
struct
LightSong
;
class
DetachedSong
;
class
SongFilter
{
public
:
...
...
@@ -111,16 +110,12 @@ public:
bool
MatchNN
(
const
Tag
&
tag
)
const
noexcept
;
gcc_pure
bool
MatchNN
(
const
DetachedSong
&
song
)
const
noexcept
;
gcc_pure
bool
MatchNN
(
const
LightSong
&
song
)
const
noexcept
;
public
:
template
<
typename
T
>
gcc_pure
bool
Match
(
const
T
&
t
)
const
noexcept
{
return
MatchNN
(
t
)
!=
IsNegated
();
bool
Match
(
const
LightSong
&
song
)
const
noexcept
{
return
MatchNN
(
song
)
!=
IsNegated
();
}
};
...
...
@@ -154,9 +149,6 @@ public:
void
Parse
(
ConstBuffer
<
const
char
*>
args
,
bool
fold_case
=
false
);
gcc_pure
bool
Match
(
const
DetachedSong
&
song
)
const
noexcept
;
gcc_pure
bool
Match
(
const
LightSong
&
song
)
const
noexcept
;
const
std
::
list
<
Item
>
&
GetItems
()
const
noexcept
{
...
...
src/queue/QueuePrint.cxx
View file @
78a65cf2
...
...
@@ -22,6 +22,8 @@
#include "Queue.hxx"
#include "SongFilter.hxx"
#include "SongPrint.hxx"
#include "DetachedSong.hxx"
#include "db/LightSong.hxx"
#include "client/Response.hxx"
/**
...
...
@@ -111,7 +113,7 @@ queue_find(Response &r, const Queue &queue,
const
SongFilter
&
filter
)
{
for
(
unsigned
i
=
0
;
i
<
queue
.
GetLength
();
i
++
)
{
const
DetachedSong
&
song
=
queue
.
Get
(
i
)
;
const
LightSong
song
{
queue
.
Get
(
i
)}
;
if
(
filter
.
Match
(
song
))
queue_print_song_info
(
r
,
queue
,
i
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment