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
85b072b3
Commit
85b072b3
authored
Mar 13, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringCompare: add StringIsEqual() with string_view
parent
8a1f1fbe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
StringCompare.hxx
src/util/StringCompare.hxx
+16
-0
WStringCompare.hxx
src/util/WStringCompare.hxx
+16
-0
No files found.
src/util/StringCompare.hxx
View file @
85b072b3
...
...
@@ -45,6 +45,22 @@ StringIsEmpty(const char *string) noexcept
return
*
string
==
0
;
}
gcc_pure
static
inline
bool
StringIsEqual
(
std
::
string_view
a
,
std
::
string_view
b
)
noexcept
{
return
a
.
size
()
==
b
.
size
()
&&
StringIsEqual
(
a
.
data
(),
b
.
data
(),
b
.
size
());
}
gcc_pure
static
inline
bool
StringIsEqualIgnoreCase
(
std
::
string_view
a
,
std
::
string_view
b
)
noexcept
{
return
a
.
size
()
==
b
.
size
()
&&
StringIsEqualIgnoreCase
(
a
.
data
(),
b
.
data
(),
b
.
size
());
}
gcc_pure
gcc_nonnull_all
static
inline
bool
StringStartsWith
(
const
char
*
haystack
,
StringView
needle
)
noexcept
...
...
src/util/WStringCompare.hxx
View file @
85b072b3
...
...
@@ -43,6 +43,22 @@ StringIsEmpty(const wchar_t *string) noexcept
return
*
string
==
0
;
}
gcc_pure
static
inline
bool
StringIsEqual
(
std
::
wstring_view
a
,
std
::
wstring_view
b
)
noexcept
{
return
a
.
size
()
==
b
.
size
()
&&
StringIsEqual
(
a
.
data
(),
b
.
data
(),
b
.
size
());
}
gcc_pure
static
inline
bool
StringIsEqualIgnoreCase
(
std
::
wstring_view
a
,
std
::
wstring_view
b
)
noexcept
{
return
a
.
size
()
==
b
.
size
()
&&
StringIsEqualIgnoreCase
(
a
.
data
(),
b
.
data
(),
b
.
size
());
}
gcc_pure
gcc_nonnull_all
static
inline
bool
StringStartsWith
(
const
wchar_t
*
haystack
,
WStringView
needle
)
noexcept
...
...
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