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
b5d1a090
Commit
b5d1a090
authored
Mar 13, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringUtil: pass std::string_view to StringArrayContainsCase()
parent
85b072b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
27 deletions
+5
-27
StringUtil.cxx
src/util/StringUtil.cxx
+3
-19
StringUtil.hxx
src/util/StringUtil.hxx
+2
-8
No files found.
src/util/StringUtil.cxx
View file @
b5d1a090
...
@@ -18,35 +18,19 @@
...
@@ -18,35 +18,19 @@
*/
*/
#include "StringUtil.hxx"
#include "StringUtil.hxx"
#include "String
View
.hxx"
#include "String
Compare
.hxx"
#include "CharUtil.hxx"
#include "CharUtil.hxx"
#include "ASCII.hxx"
#include <cassert>
#include <cassert>
bool
bool
StringArrayContainsCase
(
const
char
*
const
*
haystack
,
StringArrayContainsCase
(
const
char
*
const
*
haystack
,
const
char
*
needle
)
noexcept
std
::
string_view
needle
)
noexcept
{
{
assert
(
haystack
!=
nullptr
);
assert
(
haystack
!=
nullptr
);
assert
(
needle
!=
nullptr
);
for
(;
*
haystack
!=
nullptr
;
++
haystack
)
for
(;
*
haystack
!=
nullptr
;
++
haystack
)
if
(
StringEqualsCaseASCII
(
*
haystack
,
needle
))
if
(
StringIsEqualIgnoreCase
(
*
haystack
,
needle
))
return
true
;
return
false
;
}
bool
StringArrayContainsCase
(
const
char
*
const
*
haystack
,
StringView
needle
)
noexcept
{
assert
(
haystack
!=
nullptr
);
assert
(
needle
!=
nullptr
);
for
(;
*
haystack
!=
nullptr
;
++
haystack
)
if
(
needle
.
EqualsIgnoreCase
(
*
haystack
))
return
true
;
return
true
;
return
false
;
return
false
;
...
...
src/util/StringUtil.hxx
View file @
b5d1a090
...
@@ -23,8 +23,7 @@
...
@@ -23,8 +23,7 @@
#include "Compiler.h"
#include "Compiler.h"
#include <cstddef>
#include <cstddef>
#include <string_view>
struct
StringView
;
/**
/**
* Checks whether a string array contains the specified string.
* Checks whether a string array contains the specified string.
...
@@ -37,12 +36,7 @@ struct StringView;
...
@@ -37,12 +36,7 @@ struct StringView;
gcc_pure
gcc_pure
bool
bool
StringArrayContainsCase
(
const
char
*
const
*
haystack
,
StringArrayContainsCase
(
const
char
*
const
*
haystack
,
const
char
*
needle
)
noexcept
;
std
::
string_view
needle
)
noexcept
;
gcc_pure
bool
StringArrayContainsCase
(
const
char
*
const
*
haystack
,
StringView
needle
)
noexcept
;
/**
/**
* Convert the specified ASCII string (0x00..0x7f) to upper case.
* Convert the specified ASCII string (0x00..0x7f) to upper case.
...
...
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