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
e620677d
Commit
e620677d
authored
Apr 03, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/icu/CaseFold: pass std::string_view
parent
09d8e44d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
13 deletions
+9
-13
CaseFold.cxx
src/lib/icu/CaseFold.cxx
+1
-6
CaseFold.hxx
src/lib/icu/CaseFold.hxx
+2
-3
Compare.cxx
src/lib/icu/Compare.cxx
+2
-2
Compare.hxx
src/lib/icu/Compare.hxx
+3
-1
StringFilter.hxx
src/song/StringFilter.hxx
+1
-1
No files found.
src/lib/icu/CaseFold.cxx
View file @
e620677d
...
...
@@ -45,14 +45,9 @@
#include <string.h>
AllocatedString
<>
IcuCaseFold
(
const
char
*
src
)
noexcept
IcuCaseFold
(
std
::
string_view
src
)
noexcept
try
{
#ifdef HAVE_ICU
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert
(
src
!=
nullptr
);
#endif
const
auto
u
=
UCharFromUTF8
(
src
);
if
(
u
.
IsNull
())
return
AllocatedString
<>::
Duplicate
(
src
);
...
...
src/lib/icu/CaseFold.hxx
View file @
e620677d
...
...
@@ -25,13 +25,12 @@
#if defined(HAVE_ICU) || defined(_WIN32)
#define HAVE_ICU_CASE_FOLD
#include
"util/Compiler.h"
#include
<string_view>
template
<
typename
T
>
class
AllocatedString
;
gcc_nonnull_all
AllocatedString
<
char
>
IcuCaseFold
(
const
char
*
src
)
noexcept
;
IcuCaseFold
(
std
::
string_view
src
)
noexcept
;
#endif
...
...
src/lib/icu/Compare.cxx
View file @
e620677d
...
...
@@ -24,12 +24,12 @@
#ifdef HAVE_ICU_CASE_FOLD
IcuCompare
::
IcuCompare
(
const
char
*
_needle
)
noexcept
IcuCompare
::
IcuCompare
(
std
::
string_view
_needle
)
noexcept
:
needle
(
IcuCaseFold
(
_needle
))
{}
#else
IcuCompare
::
IcuCompare
(
const
char
*
_needle
)
noexcept
IcuCompare
::
IcuCompare
(
std
::
string_view
_needle
)
noexcept
:
needle
(
AllocatedString
<>::
Duplicate
(
_needle
))
{}
#endif
...
...
src/lib/icu/Compare.hxx
View file @
e620677d
...
...
@@ -23,6 +23,8 @@
#include "util/Compiler.h"
#include "util/AllocatedString.hxx"
#include <string_view>
/**
* This class can compare one string ("needle") with lots of other
* strings ("haystacks") efficiently, ignoring case. With some
...
...
@@ -34,7 +36,7 @@ class IcuCompare {
public
:
IcuCompare
()
:
needle
(
nullptr
)
{}
explicit
IcuCompare
(
const
char
*
needle
)
noexcept
;
explicit
IcuCompare
(
std
::
string_view
needle
)
noexcept
;
IcuCompare
(
const
IcuCompare
&
src
)
noexcept
:
needle
(
src
...
...
src/song/StringFilter.hxx
View file @
e620677d
...
...
@@ -55,7 +55,7 @@ public:
StringFilter
(
V
&&
_value
,
bool
_fold_case
,
bool
_substring
,
bool
_negated
)
:
value
(
std
::
forward
<
V
>
(
_value
)),
fold_case
(
_fold_case
?
IcuCompare
(
value
.
c_str
()
)
?
IcuCompare
(
value
)
:
IcuCompare
()),
substring
(
_substring
),
negated
(
_negated
)
{}
...
...
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