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
814b2a21
Commit
814b2a21
authored
Apr 27, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/CharUtil: add IsNonPrintableASCII()
Prepare to fix
cc72ceb3
parent
6423670e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
CharUtil.hxx
src/util/CharUtil.hxx
+18
-1
WCharUtil.hxx
src/util/WCharUtil.hxx
+19
-1
No files found.
src/util/CharUtil.hxx
View file @
814b2a21
/*
* Copyright
(C) 2011-2017
Max Kellermann <max.kellermann@gmail.com>
* Copyright
2011-2020
Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -70,12 +70,29 @@ IsWhitespaceFast(const char ch) noexcept
return
IsWhitespaceOrNull
(
ch
);
}
/**
* Is this a non-printable ASCII character? Returns false for
* non-ASCII characters.
*
* Note that this is not the opposide of IsNonPrintableASCII().
*/
constexpr
bool
IsPrintableASCII
(
char
ch
)
noexcept
{
return
(
signed
char
)
ch
>=
0x20
;
}
/**
* Is this a non-printable character? Returns false for non-ASCII characters.
*
* Note that this is not the opposide of IsPrintableASCII()
*/
constexpr
bool
IsNonPrintableASCII
(
char
ch
)
noexcept
{
return
(
unsigned
char
)
ch
<
0x20
;
}
constexpr
bool
IsDigitASCII
(
char
ch
)
noexcept
{
...
...
src/util/WCharUtil.hxx
View file @
814b2a21
/*
* Copyright 2011-20
19
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2011-20
20
Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -62,12 +62,30 @@ IsWhitespaceFast(const wchar_t ch) noexcept
return
IsWhitespaceOrNull
(
ch
);
}
/**
* Is this a non-printable ASCII character? Returns false for
* non-ASCII characters.
*
* Note that this is not the opposide of IsNonPrintableASCII().
*/
constexpr
bool
IsPrintableASCII
(
wchar_t
ch
)
noexcept
{
return
IsASCII
(
ch
)
&&
ch
>=
0x20
;
}
/**
* Is this a non-printable character? Returns false for non-ASCII
* characters.
*
* Note that this is not the opposide of IsPrintableASCII()
*/
constexpr
bool
IsNonPrintableASCII
(
wchar_t
ch
)
noexcept
{
return
(
unsigned
)
ch
<
0x20
;
}
constexpr
bool
IsDigitASCII
(
wchar_t
ch
)
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