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
6fe43ed9
Commit
6fe43ed9
authored
Nov 04, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
song/StringFilter: add flag `substring`
Prepare to stop using substrings for filter expressions.
parent
b34bc066
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
StringFilter.cxx
src/song/StringFilter.cxx
+6
-2
StringFilter.hxx
src/song/StringFilter.hxx
+7
-1
No files found.
src/song/StringFilter.cxx
View file @
6fe43ed9
...
...
@@ -32,8 +32,12 @@ StringFilter::Match(const char *s) const noexcept
#endif
if
(
fold_case
)
{
return
fold_case
.
IsIn
(
s
);
return
substring
?
fold_case
.
IsIn
(
s
)
:
fold_case
==
s
;
}
else
{
return
value
==
s
;
return
substring
?
StringFind
(
s
,
value
.
c_str
())
!=
nullptr
:
value
==
s
;
}
}
src/song/StringFilter.hxx
View file @
6fe43ed9
...
...
@@ -33,13 +33,19 @@ class StringFilter {
*/
IcuCompare
fold_case
;
/**
* Search for substrings instead of matching the whole string?
*/
bool
substring
;
public
:
template
<
typename
V
>
StringFilter
(
V
&&
_value
,
bool
_fold_case
)
:
value
(
std
::
forward
<
V
>
(
_value
)),
fold_case
(
_fold_case
?
IcuCompare
(
value
.
c_str
())
:
IcuCompare
())
{}
:
IcuCompare
()),
substring
(
_fold_case
)
{}
bool
empty
()
const
noexcept
{
return
value
.
empty
();
...
...
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