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
1a7e3bb3
Commit
1a7e3bb3
authored
Jun 11, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringUtil: add StringArrayContainsCase() overload with StringView
parent
74380d2a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
StringUtil.cxx
src/util/StringUtil.cxx
+16
-1
StringUtil.hxx
src/util/StringUtil.hxx
+8
-1
No files found.
src/util/StringUtil.cxx
View file @
1a7e3bb3
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,6 +18,7 @@
*/
#include "StringUtil.hxx"
#include "StringView.hxx"
#include "CharUtil.hxx"
#include "ASCII.hxx"
...
...
@@ -37,6 +38,20 @@ StringArrayContainsCase(const char *const*haystack,
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
false
;
}
void
ToUpperASCII
(
char
*
dest
,
const
char
*
src
,
size_t
size
)
noexcept
{
...
...
src/util/StringUtil.hxx
View file @
1a7e3bb3
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -24,6 +24,8 @@
#include <stddef.h>
struct
StringView
;
/**
* Checks whether a string array contains the specified string.
*
...
...
@@ -37,6 +39,11 @@ bool
StringArrayContainsCase
(
const
char
*
const
*
haystack
,
const
char
*
needle
)
noexcept
;
gcc_pure
bool
StringArrayContainsCase
(
const
char
*
const
*
haystack
,
StringView
needle
)
noexcept
;
/**
* 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