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
7aa84975
Commit
7aa84975
authored
Jul 25, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SongFilter: implement the AND operator
parent
7a8d5070
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
protocol.xml
doc/protocol.xml
+7
-0
SongFilter.cxx
src/SongFilter.cxx
+17
-1
No files found.
doc/protocol.xml
View file @
7aa84975
...
...
@@ -268,6 +268,13 @@
time stamp).
</para>
</listitem>
<listitem>
<para>
"
<code>
EXPRESSION1 AND EXPRESSION2 ...
</code>
": combine two or
more expressions with logical "and".
</para>
</listitem>
</itemizedlist>
<para>
...
...
src/SongFilter.cxx
View file @
7aa84975
...
...
@@ -334,7 +334,23 @@ SongFilter::ParseExpression(const char *&s, bool fold_case)
return
first
;
}
throw
std
::
runtime_error
(
"Nested expressions not yet implemented"
);
if
(
ExpectWord
(
s
)
!=
"AND"
)
throw
std
::
runtime_error
(
"'AND' expected"
);
auto
and_filter
=
std
::
make_unique
<
AndSongFilter
>
();
and_filter
->
AddItem
(
std
::
move
(
first
));
while
(
true
)
{
and_filter
->
AddItem
(
ParseExpression
(
s
,
fold_case
));
if
(
*
s
==
')'
)
{
++
s
;
return
and_filter
;
}
if
(
ExpectWord
(
s
)
!=
"AND"
)
throw
std
::
runtime_error
(
"'AND' expected"
);
}
}
auto
type
=
ExpectFilterType
(
s
);
...
...
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