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
9d3d4fc7
Commit
9d3d4fc7
authored
Jul 05, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/CharUtil: add `noexcept`
parent
d6660bad
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
CharUtil.hxx
src/util/CharUtil.hxx
+13
-13
WCharUtil.hxx
src/util/WCharUtil.hxx
+12
-12
No files found.
src/util/CharUtil.hxx
View file @
9d3d4fc7
...
...
@@ -35,25 +35,25 @@
#endif
constexpr
bool
IsASCII
(
const
unsigned
char
ch
)
IsASCII
(
const
unsigned
char
ch
)
noexcept
{
return
ch
<
0x80
;
}
constexpr
bool
IsASCII
(
const
char
ch
)
IsASCII
(
const
char
ch
)
noexcept
{
return
IsASCII
((
unsigned
char
)
ch
);
}
constexpr
bool
IsWhitespaceOrNull
(
const
char
ch
)
IsWhitespaceOrNull
(
const
char
ch
)
noexcept
{
return
(
unsigned
char
)
ch
<=
0x20
;
}
constexpr
bool
IsWhitespaceNotNull
(
const
char
ch
)
IsWhitespaceNotNull
(
const
char
ch
)
noexcept
{
return
ch
>
0
&&
ch
<=
0x20
;
}
...
...
@@ -65,43 +65,43 @@ IsWhitespaceNotNull(const char ch)
* matches.
*/
constexpr
bool
IsWhitespaceFast
(
const
char
ch
)
IsWhitespaceFast
(
const
char
ch
)
noexcept
{
return
IsWhitespaceOrNull
(
ch
);
}
constexpr
bool
IsPrintableASCII
(
char
ch
)
IsPrintableASCII
(
char
ch
)
noexcept
{
return
(
signed
char
)
ch
>=
0x20
;
}
constexpr
bool
IsDigitASCII
(
char
ch
)
IsDigitASCII
(
char
ch
)
noexcept
{
return
ch
>=
'0'
&&
ch
<=
'9'
;
}
constexpr
bool
IsUpperAlphaASCII
(
char
ch
)
IsUpperAlphaASCII
(
char
ch
)
noexcept
{
return
ch
>=
'A'
&&
ch
<=
'Z'
;
}
constexpr
bool
IsLowerAlphaASCII
(
char
ch
)
IsLowerAlphaASCII
(
char
ch
)
noexcept
{
return
ch
>=
'a'
&&
ch
<=
'z'
;
}
constexpr
bool
IsAlphaASCII
(
char
ch
)
IsAlphaASCII
(
char
ch
)
noexcept
{
return
IsUpperAlphaASCII
(
ch
)
||
IsLowerAlphaASCII
(
ch
);
}
constexpr
bool
IsAlphaNumericASCII
(
char
ch
)
IsAlphaNumericASCII
(
char
ch
)
noexcept
{
return
IsAlphaASCII
(
ch
)
||
IsDigitASCII
(
ch
);
}
...
...
@@ -111,7 +111,7 @@ IsAlphaNumericASCII(char ch)
* Unlike toupper(), it ignores the system locale.
*/
constexpr
char
ToUpperASCII
(
char
ch
)
ToUpperASCII
(
char
ch
)
noexcept
{
return
ch
>=
'a'
&&
ch
<=
'z'
?
(
ch
-
(
'a'
-
'A'
))
...
...
@@ -123,7 +123,7 @@ ToUpperASCII(char ch)
* Unlike tolower(), it ignores the system locale.
*/
constexpr
char
ToLowerASCII
(
char
ch
)
ToLowerASCII
(
char
ch
)
noexcept
{
return
ch
>=
'A'
&&
ch
<=
'Z'
?
(
ch
+
(
'a'
-
'A'
))
...
...
src/util/WCharUtil.hxx
View file @
9d3d4fc7
...
...
@@ -33,19 +33,19 @@
#include <wchar.h>
constexpr
bool
IsASCII
(
const
wchar_t
ch
)
IsASCII
(
const
wchar_t
ch
)
noexcept
{
return
(
ch
&
~
0x7f
)
==
0
;
}
constexpr
bool
IsWhitespaceOrNull
(
const
wchar_t
ch
)
IsWhitespaceOrNull
(
const
wchar_t
ch
)
noexcept
{
return
(
unsigned
)
ch
<=
0x20
;
}
constexpr
bool
IsWhitespaceNotNull
(
const
wchar_t
ch
)
IsWhitespaceNotNull
(
const
wchar_t
ch
)
noexcept
{
return
ch
>
0
&&
ch
<=
0x20
;
}
...
...
@@ -57,43 +57,43 @@ IsWhitespaceNotNull(const wchar_t ch)
* matches.
*/
constexpr
bool
IsWhitespaceFast
(
const
wchar_t
ch
)
IsWhitespaceFast
(
const
wchar_t
ch
)
noexcept
{
return
IsWhitespaceOrNull
(
ch
);
}
constexpr
bool
IsPrintableASCII
(
wchar_t
ch
)
IsPrintableASCII
(
wchar_t
ch
)
noexcept
{
return
IsASCII
(
ch
)
&&
ch
>=
0x20
;
}
constexpr
bool
IsDigitASCII
(
wchar_t
ch
)
IsDigitASCII
(
wchar_t
ch
)
noexcept
{
return
ch
>=
'0'
&&
ch
<=
'9'
;
}
constexpr
bool
IsUpperAlphaASCII
(
wchar_t
ch
)
IsUpperAlphaASCII
(
wchar_t
ch
)
noexcept
{
return
ch
>=
'A'
&&
ch
<=
'Z'
;
}
constexpr
bool
IsLowerAlphaASCII
(
wchar_t
ch
)
IsLowerAlphaASCII
(
wchar_t
ch
)
noexcept
{
return
ch
>=
'a'
&&
ch
<=
'z'
;
}
constexpr
bool
IsAlphaASCII
(
wchar_t
ch
)
IsAlphaASCII
(
wchar_t
ch
)
noexcept
{
return
IsUpperAlphaASCII
(
ch
)
||
IsLowerAlphaASCII
(
ch
);
}
constexpr
bool
IsAlphaNumericASCII
(
wchar_t
ch
)
IsAlphaNumericASCII
(
wchar_t
ch
)
noexcept
{
return
IsAlphaASCII
(
ch
)
||
IsDigitASCII
(
ch
);
}
...
...
@@ -103,7 +103,7 @@ IsAlphaNumericASCII(wchar_t ch)
* Unlike toupper(), it ignores the system locale.
*/
constexpr
wchar_t
ToUpperASCII
(
wchar_t
ch
)
ToUpperASCII
(
wchar_t
ch
)
noexcept
{
return
ch
>=
'a'
&&
ch
<=
'z'
?
(
ch
-
(
'a'
-
'A'
))
...
...
@@ -115,7 +115,7 @@ ToUpperASCII(wchar_t ch)
* Unlike tolower(), it ignores the system locale.
*/
constexpr
wchar_t
ToLowerASCII
(
wchar_t
ch
)
ToLowerASCII
(
wchar_t
ch
)
noexcept
{
return
ch
>=
'A'
&&
ch
<=
'Z'
?
(
ch
+
(
'a'
-
'A'
))
...
...
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